1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-28 18:25:23 +00:00

bug fix for observer

This commit is contained in:
Shelikhoo 2021-06-19 12:19:21 +01:00
parent 6fd8e36a3b
commit ab803000e7
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316
2 changed files with 3 additions and 3 deletions

View File

@ -2,13 +2,13 @@ package burst
import ( import (
"context" "context"
"github.com/golang/protobuf/proto"
core "github.com/v2fly/v2ray-core/v4" core "github.com/v2fly/v2ray-core/v4"
"github.com/v2fly/v2ray-core/v4/app/observatory" "github.com/v2fly/v2ray-core/v4/app/observatory"
"github.com/v2fly/v2ray-core/v4/common" "github.com/v2fly/v2ray-core/v4/common"
"github.com/v2fly/v2ray-core/v4/common/signal/done" "github.com/v2fly/v2ray-core/v4/common/signal/done"
"github.com/v2fly/v2ray-core/v4/features/extension" "github.com/v2fly/v2ray-core/v4/features/extension"
"github.com/v2fly/v2ray-core/v4/features/outbound" "github.com/v2fly/v2ray-core/v4/features/outbound"
"google.golang.org/protobuf/proto"
"sync" "sync"
) )
@ -34,7 +34,7 @@ func (o *Observer) createResult() []*observatory.OutboundStatus {
defer o.hp.access.Unlock() defer o.hp.access.Unlock()
for name, value := range o.hp.Results { for name, value := range o.hp.Results {
status := observatory.OutboundStatus{ status := observatory.OutboundStatus{
Alive: value.getStatistics().All == value.getStatistics().Fail, Alive: value.getStatistics().All != value.getStatistics().Fail,
Delay: value.getStatistics().Average.Milliseconds(), Delay: value.getStatistics().Average.Milliseconds(),
LastErrorReason: "", LastErrorReason: "",
OutboundTag: name, OutboundTag: name,

View File

@ -28,7 +28,7 @@ type BurstObservatoryConfig struct {
} }
func (b BurstObservatoryConfig) Build() (proto.Message, error) { func (b BurstObservatoryConfig) Build() (proto.Message, error) {
if result, err := b.HealthCheck.Build(); err != nil { if result, err := b.HealthCheck.Build(); err == nil {
return &burst.Config{SubjectSelector: b.SubjectSelector, PingConfig: result.(*burst.HealthPingConfig)}, nil return &burst.Config{SubjectSelector: b.SubjectSelector, PingConfig: result.(*burst.HealthPingConfig)}, nil
} else { } else {
return nil, err return nil, err