chorus.py 文件源码

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

项目:wade 作者: chartbeat-labs 项目源码 文件源码
def __init__(self, conf, timeout):
        self._conf = conf
        self._timeout = timeout
        self._unpacker = msgpack.Unpacker()
        self._packer = msgpack.Packer()

        # connection variables
        self._peers = {} # peer_id -> Peer
        self._sock_to_peer = {} # socket.connection -> Peer
        self._peers_lock = threading.Lock() # for _peers and _sock_to_peers

        # request / response variables
        self._req_count = 0
        self._req_count_lock = threading.Lock()

        # For reuse of ValueEvent objects by a thread.
        self._threadlocal = threading.local()

        self._patch_client_for_gevent()

        self._bg_thread = threading.Thread(
            target=self._process_requests_in_background
        )
        self._bg_thread.setDaemon(True)
        self._bg_thread.start()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号