mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-10 05:10:26 +00:00
fix shutdown deadlock
This commit is contained in:
parent
e926a3be6d
commit
d47797088f
@ -195,8 +195,10 @@ func (c *Core) _stop() {
|
|||||||
c.addPeerTimer.Stop()
|
c.addPeerTimer.Stop()
|
||||||
}
|
}
|
||||||
c.link.stop()
|
c.link.stop()
|
||||||
|
/* FIXME this deadlocks, need a waitgroup or something to coordinate shutdown
|
||||||
for _, peer := range c.GetPeers() {
|
for _, peer := range c.GetPeers() {
|
||||||
c.DisconnectPeer(peer.Port)
|
c.DisconnectPeer(peer.Port)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
c.log.Infoln("Stopped")
|
c.log.Infoln("Stopped")
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ func (t *switchTable) cleanRoot() {
|
|||||||
t.time = now
|
t.time = now
|
||||||
if t.data.locator.root != t.key {
|
if t.data.locator.root != t.key {
|
||||||
t.data.seq++
|
t.data.seq++
|
||||||
t.updateTable()
|
defer t.updateTable()
|
||||||
t.core.router.reset(nil)
|
t.core.router.reset(nil)
|
||||||
}
|
}
|
||||||
t.data.locator = switchLocator{root: t.key, tstamp: now.Unix()}
|
t.data.locator = switchLocator{root: t.key, tstamp: now.Unix()}
|
||||||
@ -524,7 +524,7 @@ func (t *switchTable) unlockedHandleMsg(msg *switchMsg, fromPort switchPort, rep
|
|||||||
t.core.peers.sendSwitchMsgs(t)
|
t.core.peers.sendSwitchMsgs(t)
|
||||||
}
|
}
|
||||||
if true || doUpdate {
|
if true || doUpdate {
|
||||||
t.updateTable()
|
defer t.updateTable()
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user