mirror of
https://github.com/sot-tech/mochi.git
synced 2026-06-13 08:13:32 -07:00
Fix semantics of seed stats, fix Peer.IPv6() always returning true
This commit is contained in:
+1
-3
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user