PEX: remove workaround for krpc marshaller

This commit is contained in:
Yaroslav Kolomiiets 2021-12-08 13:02:36 +00:00
parent bdb218a698
commit 102f3182fc
1 changed files with 1 additions and 9 deletions

10
pex.go
View File

@ -153,15 +153,7 @@ func (me *pexMsgFactory) PexMsg() pp.PexMsg {
func nodeAddr(addr PeerRemoteAddr) (krpc.NodeAddr, bool) {
ipport, _ := tryIpPortFromNetAddr(addr)
ok := ipport.IP != nil
return krpc.NodeAddr{IP: shortestIP(ipport.IP), Port: ipport.Port}, ok
}
// mainly for the krpc marshallers
func shortestIP(ip net.IP) net.IP {
if ip4 := ip.To4(); ip4 != nil {
return ip4
}
return ip
return krpc.NodeAddr{IP: ipport.IP, Port: ipport.Port}, ok
}
// Per-torrent PEX state