mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-17 22:18:05 -06:00
Use QHostAddress for storing IP
This commit is contained in:
@@ -60,7 +60,7 @@ bool Peer::operator==(const Peer &other) const
|
|||||||
|
|
||||||
QString Peer::uid() const
|
QString Peer::uid() const
|
||||||
{
|
{
|
||||||
return ip + ':' + QString::number(port);
|
return ip.toString() + ':' + QString::number(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
libtorrent::entry Peer::toEntry(bool noPeerId) const
|
libtorrent::entry Peer::toEntry(bool noPeerId) const
|
||||||
@@ -68,7 +68,7 @@ libtorrent::entry Peer::toEntry(bool noPeerId) const
|
|||||||
libtorrent::entry::dictionary_type peerMap;
|
libtorrent::entry::dictionary_type peerMap;
|
||||||
if (!noPeerId)
|
if (!noPeerId)
|
||||||
peerMap["id"] = libtorrent::entry(peerId.toStdString());
|
peerMap["id"] = libtorrent::entry(peerId.toStdString());
|
||||||
peerMap["ip"] = libtorrent::entry(ip.toStdString());
|
peerMap["ip"] = libtorrent::entry(ip.toString().toStdString());
|
||||||
peerMap["port"] = libtorrent::entry(port);
|
peerMap["port"] = libtorrent::entry(port);
|
||||||
|
|
||||||
return libtorrent::entry(peerMap);
|
return libtorrent::entry(peerMap);
|
||||||
@@ -148,7 +148,7 @@ void Tracker::respondToAnnounceRequest()
|
|||||||
TrackerAnnounceRequest annonceReq;
|
TrackerAnnounceRequest annonceReq;
|
||||||
|
|
||||||
// IP
|
// IP
|
||||||
annonceReq.peer.ip = m_env.clientAddress.toString();
|
annonceReq.peer.ip = m_env.clientAddress;
|
||||||
|
|
||||||
// 1. Get info_hash
|
// 1. Get info_hash
|
||||||
if (!queryParams.contains("info_hash")) {
|
if (!queryParams.contains("info_hash")) {
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QHostAddress>
|
||||||
|
|
||||||
#include "base/http/irequesthandler.h"
|
#include "base/http/irequesthandler.h"
|
||||||
#include "base/http/responsebuilder.h"
|
#include "base/http/responsebuilder.h"
|
||||||
@@ -51,7 +52,7 @@ namespace BitTorrent
|
|||||||
{
|
{
|
||||||
struct Peer
|
struct Peer
|
||||||
{
|
{
|
||||||
QString ip;
|
QHostAddress ip;
|
||||||
QByteArray peerId;
|
QByteArray peerId;
|
||||||
int port;
|
int port;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user