Show any multiple connections from the same IP in peer list

The uniqueness of peers is now determined by their
IP, port and connection type (uTP etc.) instead of just their IP
This commit is contained in:
thalieht
2020-01-28 21:32:15 +02:00
parent c3ce1aaa3d
commit 5f415c292d
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));
}