Start endpoint tunnel watch before waiting

pull/652/head
Erik Wilson 2019-07-17 17:13:40 -07:00
parent 2d32337334
commit b93b4732eb
1 changed files with 5 additions and 1 deletions

View File

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