if ipAddr, ok := tryIpPortFromNetAddr(p.Addr); ok {
if cl.badPeerIPPort(ipAddr.IP, ipAddr.Port) {
torrent.Add("peers not added because of bad addr", 1)
- cl.logger.Printf("peers not added because of bad addr: %v", p)
+ // cl.logger.Printf("peers not added because of bad addr: %v", p)
return
}
}
}
_, ret = t.conns[c]
delete(t.conns, c)
+ if !t.cl.config.DisablePEX {
+ t.pex.Drop(c)
+ }
torrent.Add("deleted connections", 1)
c.deleteAllRequests()
if len(t.conns) == 0 {
func (t *Torrent) dropConnection(c *PeerConn) {
t.cl.event.Broadcast()
- if !t.cl.config.DisablePEX {
- t.pex.Drop(c)
- }
c.close()
if t.deleteConnection(c) {
t.openNewConns()
panic(len(t.conns))
}
t.conns[c] = struct{}{}
- if !t.cl.config.DisablePEX {
- t.pex.Add(c)
+ if !t.cl.config.DisablePEX && !c.PeerExtensionBytes.SupportsExtended() {
+ t.pex.Add(c) // as no further extended handshake expected
}
return nil
}