peer.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:python-pythorrent 作者: yamatt 项目源码 文件源码
def recv_bitfield(self, length):
        """
        Received only at the start of a connection when a peer wants to
        tell you all the pieces it has in a very compact form.
        :param length: The size of the payload, a number of bits
            representing the number of pieces
        """
        payload = self.recv(length)
        bits = BitArray(bytes=payload)
        for i in range(len(self.torrent.pieces)):
            sha, piece = self.torrent.pieces.items()[i]
            piece = self.PIECE(sha, self, have=bits[i])
            self.pieces[sha] = piece
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号