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
committed by sledgehammer999
parent fbb01a36e6
commit 756bc3da54
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);
}