Start endpoint tunnel watch before waiting

This commit is contained in:
Erik Wilson 2019-07-17 17:13:40 -07:00
parent 2d32337334
commit b93b4732eb

View File

@ -83,7 +83,6 @@ func Setup(config *config.Node) error {
disconnect[address] = connect(wg, address, config, transportConfig)
}
}
wg.Wait()
go func() {
connect:
@ -134,6 +133,8 @@ func Setup(config *config.Node) error {
}
}()
wg.Wait()
return nil
}
@ -178,6 +179,9 @@ func connect(waitGroup *sync.WaitGroup, address string, config *config.Node, tra
})
if ctx.Err() != nil {
if waitGroup != nil {
once.Do(waitGroup.Done)
}
logrus.Infof("Stopped tunnel to %s", wsURL)
return
}