Change to lt namespace

Quoting from libtorrent doc:
> In the future, libtorrent will be the alias and lt the namespace name.
This commit is contained in:
Chocobo1
2019-05-09 12:45:52 +08:00
parent 4b263f057d
commit 3955eef50d
18 changed files with 124 additions and 127 deletions

View File

@@ -58,15 +58,15 @@ QString Peer::uid() const
return ip.toString() + ':' + QString::number(port);
}
libtorrent::entry Peer::toEntry(const bool noPeerId) const
lt::entry Peer::toEntry(const bool noPeerId) const
{
libtorrent::entry::dictionary_type peerMap;
lt::entry::dictionary_type peerMap;
if (!noPeerId)
peerMap["id"] = libtorrent::entry(peerId.toStdString());
peerMap["ip"] = libtorrent::entry(ip.toString().toStdString());
peerMap["port"] = libtorrent::entry(port);
peerMap["id"] = lt::entry(peerId.toStdString());
peerMap["ip"] = lt::entry(ip.toString().toStdString());
peerMap["port"] = lt::entry(port);
return libtorrent::entry(peerMap);
return lt::entry(peerMap);
}
// Tracker
@@ -247,18 +247,18 @@ void Tracker::unregisterPeer(const TrackerAnnounceRequest &announceReq)
void Tracker::replyWithPeerList(const TrackerAnnounceRequest &announceReq)
{
// Prepare the entry for bencoding
libtorrent::entry::dictionary_type replyDict;
replyDict["interval"] = libtorrent::entry(ANNOUNCE_INTERVAL);
lt::entry::dictionary_type replyDict;
replyDict["interval"] = lt::entry(ANNOUNCE_INTERVAL);
libtorrent::entry::list_type peerList;
lt::entry::list_type peerList;
for (const Peer &p : m_torrents.value(announceReq.infoHash))
peerList.push_back(p.toEntry(announceReq.noPeerId));
replyDict["peers"] = libtorrent::entry(peerList);
replyDict["peers"] = lt::entry(peerList);
const libtorrent::entry replyEntry(replyDict);
const lt::entry replyEntry(replyDict);
// bencode
QByteArray reply;
libtorrent::bencode(std::back_inserter(reply), replyEntry);
lt::bencode(std::back_inserter(reply), replyEntry);
qDebug("Tracker: reply with the following bencoded data:\n %s", reply.constData());
// HTTP reply