mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
remove peer timeout logic from the switch, so switch peer entrires are only removed when the peer struct is removed
This commit is contained in:
parent
3b783fbf97
commit
85afe187ff
3 changed files with 11 additions and 17 deletions
|
@ -150,6 +150,9 @@ func (ps *peers) removePeer(port switchPort) {
|
|||
if port == 0 {
|
||||
return
|
||||
} // Can't remove self peer
|
||||
ps.core.router.doAdmin(func() {
|
||||
ps.core.switchTable.removePeer(port)
|
||||
})
|
||||
ps.mutex.Lock()
|
||||
oldPorts := ps.getPorts()
|
||||
p, isIn := oldPorts[port]
|
||||
|
@ -160,8 +163,11 @@ func (ps *peers) removePeer(port switchPort) {
|
|||
delete(newPorts, port)
|
||||
ps.putPorts(newPorts)
|
||||
ps.mutex.Unlock()
|
||||
if isIn && p.close != nil {
|
||||
p.close()
|
||||
if isIn {
|
||||
if p.close != nil {
|
||||
p.close()
|
||||
}
|
||||
close(p.linkIn)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue