lib: Faster termination on exit (ref #6319) (#6329)

This commit is contained in:
Simon Frei
2020-02-13 14:43:00 +01:00
committed by GitHub
parent ca90f4e6af
commit c3637f2191
9 changed files with 71 additions and 28 deletions
+7 -1
View File
@@ -360,6 +360,12 @@ func (s *service) connect(ctx context.Context) {
var seen []string
for _, deviceCfg := range cfg.Devices {
select {
case <-ctx.Done():
return
default:
}
deviceID := deviceCfg.DeviceID
if deviceID == s.myID {
continue
@@ -380,7 +386,7 @@ func (s *service) connect(ctx context.Context) {
for _, addr := range deviceCfg.Addresses {
if addr == "dynamic" {
if s.discoverer != nil {
if t, err := s.discoverer.Lookup(deviceID); err == nil {
if t, err := s.discoverer.Lookup(ctx, deviceID); err == nil {
addrs = append(addrs, t...)
}
}