Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

作者在peers_request时搜集hash info,导致大量的hash info不可用 #36

Open
691778949 opened this issue Jan 6, 2021 · 0 comments

Comments

@691778949
Copy link

def on_get_peers_request(self, msg, address):
"""
处理 get_peers 请求,获取 info hash

    :param msg: 节点报文信息
    :param address: 节点地址
    """
    tid = msg[b"t"]
    try:
        info_hash = msg[b"a"][b"info_hash"]
        self.save_magnet(info_hash)
    except KeyError:
        # 没有对应的 info hash,发送错误回复
        self.send_error(tid, address)

get_peers 消息里的 info_hash 我们可以进行忽略,此时对方也是在查找对应 info_hash 的种子文件,只有收到 announce_peer 消息时的 info_hash 对我们才有用,因为它表示当前对方正在指定端口下载该种子文件的 metadata 信息。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant