mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-02-20 23:47:21 -05:00
Fix: observatory starts with empty config & fails to close (#957)
This commit is contained in:
parent
411a50c8fa
commit
980fb59878
@ -44,13 +44,18 @@ func (o *Observer) Type() interface{} {
|
||||
}
|
||||
|
||||
func (o *Observer) Start() error {
|
||||
o.finished = done.New()
|
||||
go o.background()
|
||||
if o.config != nil && len(o.config.SubjectSelector) != 0 {
|
||||
o.finished = done.New()
|
||||
go o.background()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *Observer) Close() error {
|
||||
return o.finished.Close()
|
||||
if o.finished != nil {
|
||||
return o.finished.Close()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *Observer) background() {
|
||||
|
@ -10,6 +10,6 @@ type ObservatoryConfig struct {
|
||||
SubjectSelector []string `json:"subjectSelector"`
|
||||
}
|
||||
|
||||
func (o ObservatoryConfig) Build() (proto.Message, error) {
|
||||
func (o *ObservatoryConfig) Build() (proto.Message, error) {
|
||||
return &observatory.Config{SubjectSelector: o.SubjectSelector}, nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user