mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
make removePeers work for TCP connections and minor admin cleanup
This commit is contained in:
parent
d34e0f92c8
commit
cdedd304af
5 changed files with 64 additions and 95 deletions
|
@ -238,19 +238,12 @@ func (iface *tcpInterface) handler(sock net.Conn) {
|
|||
util_putBytes(msg)
|
||||
}
|
||||
}
|
||||
p.close = func() { sock.Close() }
|
||||
setNoDelay(sock, true)
|
||||
go p.linkLoop(linkIn)
|
||||
defer func() {
|
||||
// Put all of our cleanup here...
|
||||
p.core.peers.mutex.Lock()
|
||||
oldPorts := p.core.peers.getPorts()
|
||||
newPorts := make(map[switchPort]*peer)
|
||||
for k, v := range oldPorts {
|
||||
newPorts[k] = v
|
||||
}
|
||||
delete(newPorts, p.port)
|
||||
p.core.peers.putPorts(newPorts)
|
||||
p.core.peers.mutex.Unlock()
|
||||
p.core.peers.removePeer(p.port)
|
||||
close(linkIn)
|
||||
}()
|
||||
them, _, _ := net.SplitHostPort(sock.RemoteAddr().String())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue