Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x BitTorrent客户端:从对等方下载最后几个块时出现问题_Python 3.x_Tcp_Bittorrent_Python Asyncio - Fatal编程技术网

Python 3.x BitTorrent客户端:从对等方下载最后几个块时出现问题

Python 3.x BitTorrent客户端:从对等方下载最后几个块时出现问题,python-3.x,tcp,bittorrent,python-asyncio,Python 3.x,Tcp,Bittorrent,Python Asyncio,我正在使用的BitTorrent客户端几乎可以正常工作,只是它无法从对等方获取最后几个块,即使请求已经发送。除了保持活动状态消息外,我没有从对等方获得任何数据,对等方在发送一些保持活动状态消息后会关闭连接 我知道有一种游戏结束模式,在这种模式下,最后几个街区有慢慢进入的趋势。但在我的例子中,当剩下几个块时,所有节点都会停止发送任何数据,并逐个关闭连接 是什么问题导致了这种情况 2016-07-19 15:05:27,131 - main.torrent_client - INFO - we ha

我正在使用的BitTorrent客户端几乎可以正常工作,只是它无法从对等方获取最后几个块,即使请求已经发送。除了
保持活动状态
消息外,我没有从对等方获得任何数据,对等方在发送一些
保持活动状态
消息后会关闭连接

我知道有一种游戏结束模式,在这种模式下,最后几个街区有慢慢进入的趋势。但在我的例子中,当剩下几个块时,所有节点都会停止发送任何数据,并逐个关闭连接

是什么问题导致了这种情况

2016-07-19 15:05:27,131 - main.torrent_client - INFO - we have piece 69
2016-07-19 15:05:27,131 - main.torrent_client - INFO - downloaded: 71, total: 72
2016-07-19 15:05:27,132 - main.torrent_client - INFO - peer queue {70, 71}
2016-07-19 15:05:27,132 - main.torrent_client - INFO - 2 blocks left to request from 198.251.56.71
2016-07-19 15:05:27,132 - main.torrent_client - INFO - pop a block from piece 70
2016-07-19 15:05:27,132 - main.torrent_client - INFO - peer queue {71}
2016-07-19 15:05:27,132 - main.torrent_client - INFO - 1 blocks left to request from 198.251.56.71
2016-07-19 15:05:27,133 - main.torrent_client - INFO - pop a block from piece 71    
2016-07-19 15:05:30,138 - main.torrent_client - INFO - requested {'index': 71, 'begin_offset': 0, 'request_length': 16384} from 198.251.56.71

2016-07-19 15:05:27,133 - main.pieces - INFO - Done requesting all the pieces!!!!!!!!!

2016-07-19 15:06:18,066 - main.torrent_client - INFO - just sent keep alive message to {'port': 57430, 'host': '198.251.56.71'}
2016-07-19 15:06:18,066 - main.torrent_client - INFO - just sent keep alive message to {'port': 29063, 'host': '38.76.93.8'}

2016-07-19 15:07:15,856 - main.torrent_client - DEBUG - Peer {'port': 29063, 'host': '38.76.93.8'} sent KEEP ALIVE message
2016-07-19 15:07:48,065 - main.torrent_client - INFO - just sent keep alive message to {'port': 57430, 'host': '198.251.56.71'}
2016-07-19 15:07:48,065 - main.torrent_client - INFO - just sent keep alive message to {'port': 29063, 'host': '38.76.93.8'}

2016-07-19 15:09:16,796 - main.torrent_client - DEBUG - Peer {'port': 29063, 'host': '38.76.93.8'} sent KEEP ALIVE message
2016-07-19 15:09:18,066 - main.torrent_client - INFO - just sent keep alive message to {'port': 57430, 'host': '198.251.56.71'}  
2016-07-19 15:10:48,070 - main.torrent_client - INFO - just sent keep alive message to {'port': 29063, 'host': '38.76.93.8'}
2016-07-19 15:11:17,785 - main.torrent_client - DEBUG - Peer {'port': 29063, 'host': '38.76.93.8'} sent KEEP ALIVE message

2016-07-19 15:13:48,073 - main.torrent_client - DEBUG - connection closed by {'port': 57430, 'host': '198.251.56.71'}

也许在发送最后一个请求后,您过早地将“不感兴趣”发送给所有同事@我不会把不感兴趣的信息发送给任何同行。有趣的是,如果我从最后一个块而不是第一个块开始请求,我也不会得到来自对等方的响应。程序从一开始就被卡住了。好吧,那么最后一个请求可能太大了。请记住,在几乎所有的torrents中,最后一段中的最后一个块都小于16 KB。这是如果你按顺序下载。(这是一件不好的事情,最稀有的优先对蜂群的健康至关重要。)@Encombe你完全正确。我忘了计算最后一块的长度,这使得最后一块不正确。非常感谢。如果您想将您的答案作为答案转发,我很乐意选择您的答案作为正确答案。也许在发送最后一个请求后,您过早地向所有同行发送了“不感兴趣”的消息@我不会把不感兴趣的信息发送给任何同行。有趣的是,如果我从最后一个块而不是第一个块开始请求,我也不会得到来自对等方的响应。程序从一开始就被卡住了。好吧,那么最后一个请求可能太大了。请记住,在几乎所有的torrents中,最后一段中的最后一个块都小于16 KB。这是如果你按顺序下载。(这是一件不好的事情,最稀有的优先对蜂群的健康至关重要。)@Encombe你完全正确。我忘了计算最后一块的长度,这使得最后一块不正确。非常感谢。如果您愿意转载,我很乐意选择您的答案作为正确答案。