Fix outbound start sequence

This commit is contained in:
世界 2023-06-13 22:38:05 +08:00
parent 4f12eba944
commit 8d5b9d240a
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
23 changed files with 197 additions and 105 deletions

17
box.go
View file

@ -217,20 +217,9 @@ func (s *Box) preStart() error {
return E.Cause(err, "pre-starting ", serviceName)
}
}
for i, out := range s.outbounds {
var tag string
if out.Tag() == "" {
tag = F.ToString(i)
} else {
tag = out.Tag()
}
if starter, isStarter := out.(common.Starter); isStarter {
s.logger.Trace("initializing outbound/", out.Type(), "[", tag, "]")
err := starter.Start()
if err != nil {
return E.Cause(err, "initialize outbound/", out.Type(), "[", tag, "]")
}
}
err := s.startOutbounds()
if err != nil {
return err
}
return s.router.Start()
}