Fixed the race. Made wait channel boolean.

This commit is contained in:
Milos Gajdos
2019-08-16 15:40:35 +01:00
parent c90e1ccb99
commit 7abdc68049
2 changed files with 13 additions and 13 deletions

View File

@@ -138,8 +138,8 @@ func (t *tun) monitor() {
return
case <-reconnect.C:
for _, node := range t.options.Nodes {
t.Lock()
if _, ok := t.links[node]; !ok {
t.Lock()
link, err := t.setupLink(node)
if err != nil {
log.Debugf("Tunnel failed to setup node link to %s: %v", node, err)
@@ -147,8 +147,8 @@ func (t *tun) monitor() {
continue
}
t.links[node] = link
t.Unlock()
}
t.Unlock()
}
}
}