Use ip parameter from tracker request if provided

Closes #9949.
This commit is contained in:
Chocobo1 2018-12-02 14:22:03 +08:00 committed by sledgehammer999
commit 6e5a969e2d
No known key found for this signature in database
GPG key ID: 6E4A2D025B7CC9A2

View file

@ -148,7 +148,9 @@ void Tracker::respondToAnnounceRequest()
TrackerAnnounceRequest annonceReq;
// IP
annonceReq.peer.ip = m_env.clientAddress;
// Use the "ip" parameter provided from tracker request first, then fall back to client IP if invalid
const QHostAddress paramIP {QString::fromLatin1(queryParams.value("ip"))};
annonceReq.peer.ip = paramIP.isNull() ? m_env.clientAddress : paramIP;
// 1. Get info_hash
if (!queryParams.contains("info_hash")) {