def __init__(self, *, log_level='ERROR'):
self.log_level = log_level
self.udp_sock = None
self._search_lock = threading.RLock()
self.search_results = {} # map name to (time, address)
self.unanswered_searches = {} # map search id (cid) to name
self.listeners = weakref.WeakSet()
self.broadcaster = ca.Broadcaster(our_role=ca.CLIENT)
self.broadcaster.log.setLevel(self.log_level)
self.command_bundle_queue = queue.Queue()
self.command_cond = threading.Condition()
self.selector = SelectorThread()
self.command_thread = threading.Thread(target=self.command_loop,
daemon=True)
self.command_thread.start()
评论列表
文章目录