// We can't take this from string, because it will lose netip's v4on6. net.ParseIP parses v4
// addresses directly to v4on6, which doesn't compare equal with v4.
ipAddr, ok := netip.AddrFromSlice(ip)
- if !ok {
- panic(ip)
- }
- g.MakeMapIfNilAndSet(&cl.badPeerIPs, ipAddr, struct{}{})
+ panicif.False(ok)
+ g.MakeMapIfNil(&cl.badPeerIPs)
+ cl.badPeerIPs[ipAddr] = 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)
+ t.slogger().Debug("dropping peer with banned ip", "peer", p, "ip", ip)
// Should this be a close?
p.drop()
}
// single peer for a piece, and we never progress that piece to completion, we
// will never smart-ban them. Discovered in
// https://github.com/anacrolix/torrent/issues/715.
- t.slogger().Warn(
+ t.slogger().Info(
"piece failed hash. banning peer",
"piece", piece,
"peer", c)
c.ban()
+ // TODO: Check if we now have no available peers for pieces we want.
}
}
}