diff --git a/client.go b/client.go index 4815d53a..86c83e20 100644 --- a/client.go +++ b/client.go @@ -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) {