libtorrent-rasterbar无法使用磁力链接下载元数据 [英] libtorrent-rasterbar can't download metadata using magnet links

查看:422
本文介绍了libtorrent-rasterbar无法使用磁力链接下载元数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用无DHT,仅带跟踪功能的libtorrent-rasterbar 0.16.13下载远程元数据文件(.torrent).

I'm trying to download a remote metadata file (.torrent) using no-DHT, tracker-only behavior with libtorrent-rasterbar 0.16.13.

不幸的是,我遇到了很多peer_disconnected错误;从我的程序中进行播种,然后通过BT或QBittorrent等客户端进行下载.

Unfortunately, I get a lot of peer_disconnected errors; seeding from my program and downloading through clients such as BT or QBittorrent works.

我正在使用十六进制编码的哈希,我不知道这是否是问题,因为libtorrent-rasterbar似乎在Magnet URI中同时支持十六进制和Base32哈希.

I'm using hex-encoded hashes, I don't know if this is the problem as libtorrent-rasterbar seems to support both Hex and Base32 hashes in the Magnet URI.

请记住,我已经有一个跟踪器,并且我不想使用DHT,但是只能将远程torrent下载到我的本地文件系统中.

Remember that I already have a tracker and I dont want to use DHT, but magnet just for downloading the remote torrent to my local filesystem.

这是我的AddMagnetLink代码:

Here's my AddMagnetLink code:

RESULT SessionManager::addMagnetLink(const QString& info_hash,
                                        const QString& torrentPath,
                                        libtorrent::torrent_handle &thndl)
{
    try
    {
        libtorrent::add_torrent_params tp;
        boost::filesystem::path path(torrentPath.toStdWString());

        std::string url;
        url.append("magnet:?xt=urn:btih:");
        url.append(info_hash.toStdString());
        url.append("&tr=udp://tracker.publicbt.com:80");

        qDebug() << "Using magnet URI:  "<< url.c_str();    
        qDebug() << "Save path is " << tp.save_path.c_str();    

        tp.paused = false;
        tp.auto_managed = true;
        tp.save_path = path.string();

        libtorrent::error_code ec;
        thndl = libtorrent::add_magnet_uri(*_lt_session, url, tp,ec);


        qDebug() << "add_torrent error_code = " << ec.message().c_str();
        qDebug() << "Has metadata";

    }
    catch (std::exception& e)
    {
        qWarning() << "(!) Exception thrown: " << e.what();
        return NKT_E_FAIL;
    }

    return S_OK;

}

示例输出:

peer_disconnected_alert: 8061b09e2229111ed93a48080835e371c89c1111 peer (1xx.1xx.3x.x5, libtorrent 0.16.0) disconnecting: [libtorrent error] connected to ourselves
peer_disconnected_alert: 8061b09e2229111ed93a48080835e371c89c1111 peer (1xx.1xx.3x.x5, Unknown) disconnecting: [asio.misc] End of file

我正在我的机器之间的本地局域网中尝试此操作.

Im trying this in my local LAN, between my machines.

(添加了更多数据)

令人惊讶的是,这仅在元数据传输中发生,因为我尝试使用普通的torrent文件并且它可以工作(种子和下载).我已经启用了metadata_transfer和ut_metadata扩展;此外,还启用了DHT,PEX,UPNP,NATPMP和本地发现.似乎在传输元数据时存在一些问题.

Surprisngly, this occurs only with metadata transfer, as I've tried with normal torrent files and it works (seeds and downloads). I've enabled metadata_transfer and ut_metadata extensions; also, DHT, PEX, UPNP, NATPMP and Local Discovery are enabled. Seems there is some problem with transferring metadata.

谢谢.

推荐答案

跟踪器只会报告您的公共IP和端口.

Trackers will only report back your public IP and port.

如果您在同一网络上有两个具有相同外部IP的客户端,并且它们尚未映射端口(使用UPnP或NAT-PMP),则它们将无法通过跟踪器相互查找.

If you have two clients on the same network, with the same external IP, and they have not mapped a port (with UPnP or NAT-PMP) they won't be able to find each other via a tracker.

您可以启用UPnP和NAT-PMP,启用本地对等点发现(本地服务发现)以使对等点在本地网络上宣告它们的存在,或者可以确保它们都可以通过其外部IP到达.您的路由器支持).您可能要同时启用两者.

You could either enable local peer discovery (local service discovery) to make the peers advertise their presence on the local network, or you could make sure they are both reachable via their external IP, by enabling UPnP and NAT-PMP (assuming your router supports that). You'd probably want to enable both.

您发布的断开连接消息表明对等方只能看到自己.

The disconnect message you post indicate that the peer can only see itself.

这篇关于libtorrent-rasterbar无法使用磁力链接下载元数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆