简体   繁体   English

Libtorrent如何设置超时时间?

[英]Libtorrent How to set timeout?

I used add_magnet_uri access to information, but there are some resources to respond slowly, what should I use to set the total time-out? 我使用add_magnet_uri访问信息,但是有一些资源响应缓慢,我应该使用什么来设置总超时时间?

http://www.rasterbar.com/products/libtorrent/manual.html http://www.rasterbar.com/products/libtorrent/manual.html

:( I did not find the relevant settings :(我没有找到相关的设置

params = {
            'save_path': '/home/sdht/data',
            'storage_mode': lt.storage_mode_sparse(),
            'paused': False,
            'auto_managed': True,
            'duplicate_is_error': True
        }
handle = lt.add_magnet_uri(self.ses, link, params)
    while (not handle.has_metadata()):
        time.sleep(.1)

There is no timeout on torrents failing to download in libtorrent. 种子无法在libtorrent中下载没有超时。 You can query the torrent for the timestamp when it was added, and if it was added long enough ago, and it's still not finished, you could remove it. 您可以在torrent中查询添加时的时间戳,如果添加的时间足够长,但尚未完成,则可以将其删除。

There's also not a lot of cost to having an idle torrent loaded, so you may want to add all the ones you want to resolve in parallel. 加载一个空闲的torrent也没有太多成本,因此您可能想要添加所有要并行解析的文件。

Also, you may want to be careful setting them all to auto_managed: True, because that way a stalled torrent may block new ones from being started. 另外,您可能需要小心地将它们全部设置为auto_managed:正确,因为那样,停滞的torrent可能会阻止启动新的torrent。 If you instead set auto_managed to False, they will all be force started. 如果将auto_managed设置为False,则将全部强制启动。

Address: http://www.rasterbar.com/products/libtorrent/manual.html#session-settings 地址: http : //www.rasterbar.com/products/libtorrent/manual.html#session-settings

        sts.user_agent = "USA Global Download"
        sts.tracker_completion_timeout = 5
        sts.tracker_receive_timeout = 5
        sts.stop_tracker_timeout = 5
        sts.active_downloads = -1
        sts.active_seeds = -1
        sts.active_limit = -1
        sts.auto_scrape_min_interval = 5
        sts.udp_tracker_token_expiry = 120
        sts.min_announce_interval = 1
        sts.inactivity_timeout = 60
        sts.connection_speed = 10
        sts.allow_multiple_connections_per_ip = True
        sts.max_out_request_queue = 128
        sts.request_queue_size = 3
        sts.use_read_cache = False

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM