Commit b93b4732 authored by Erik Wilson's avatar Erik Wilson

Start endpoint tunnel watch before waiting

parent 2d323373
...@@ -83,7 +83,6 @@ func Setup(config *config.Node) error { ...@@ -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 { ...@@ -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 ...@@ -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
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment