When banning an IP drop peers that match
This commit is contained in:
parent
91ecb1f0aa
commit
162cef5d1b
|
@ -1489,6 +1489,14 @@ func (cl *Client) banPeerIP(ip net.IP) {
|
|||
cl.badPeerIPs = make(map[string]struct{})
|
||||
}
|
||||
cl.badPeerIPs[ip.String()] = struct{}{}
|
||||
for _, t := range cl.torrents {
|
||||
t.iterPeers(func(p *Peer) {
|
||||
if p.remoteIp().Equal(ip) {
|
||||
t.logger.Levelf(log.Warning, "dropping peer %v with banned ip %v", p, ip)
|
||||
p.drop()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (cl *Client) newConnection(nc net.Conn, outgoing bool, remoteAddr PeerRemoteAddr, network, connString string) (c *PeerConn) {
|
||||
|
|
Loading…
Reference in New Issue