Merge pull request #11918 from thalieht/peerssameip

Show any multiple connections from the same IP in peer list
This commit is contained in:
Mike Tzou
2020-01-30 12:59:17 +08:00
committed by GitHub
4 changed files with 59 additions and 21 deletions

View File

@@ -68,3 +68,13 @@ QString PeerAddress::toString() const
: ip.toString();
return (ipStr + ':' + QString::number(port));
}
bool BitTorrent::operator==(const BitTorrent::PeerAddress &left, const BitTorrent::PeerAddress &right)
{
return (left.ip == right.ip) && (left.port == right.port);
}
uint BitTorrent::qHash(const BitTorrent::PeerAddress &addr, const uint seed)
{
return (::qHash(addr.ip, seed) ^ ::qHash(addr.port));
}

View File

@@ -42,4 +42,7 @@ namespace BitTorrent
static PeerAddress parse(const QString &address);
QString toString() const;
};
bool operator==(const PeerAddress &left, const PeerAddress &right);
uint qHash(const PeerAddress &addr, uint seed);
}