Fix semantics of seed stats, fix Peer.IPv6() always returning true

This commit is contained in:
Justin Li
2014-07-22 01:06:30 -04:00
parent 26f87139e0
commit e17c984ec8
3 changed files with 11 additions and 5 deletions
+1 -3
View File
@@ -259,9 +259,7 @@ func appendPeers(ipv4s, ipv6s models.PeerList, ann *models.Announce, announcer *
for _, peer := range peers {
if count >= wanted {
break
}
if peersEquivalent(&peer, announcer) {
} else if peersEquivalent(&peer, announcer) {
continue
}
+2 -2
View File
@@ -71,11 +71,11 @@ func NewPeer(a *Announce, u *User, t *Torrent) *Peer {
}
func (p *Peer) IPv4() bool {
return len(p.IP.To4()) == 4
return p.IP.To4() != nil
}
func (p *Peer) IPv6() bool {
return len(p.IP.To16()) == 16
return !p.IPv4()
}
// Torrent is a swarm for a given torrent file.