p2p.py 文件源码

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

项目:p2pool-bch 作者: amarian12 项目源码 文件源码
def _think(self):
        try:
            if len(self.conns) < self.desired_conns and len(self.attempts) < self.max_attempts and self.node.addr_store:
                (host, port), = self.node.get_good_peers(1)

                if self._host_to_ident(host) in self.attempts:
                    pass
                elif host in self.node.bans and self.node.bans[host] > time.time():
                    pass
                else:
                    #print 'Trying to connect to', host, port
                    reactor.connectTCP(host, port, self, timeout=5)
        except:
            log.err()

        return random.expovariate(1/1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号