def close_peer(self, location, timeout=MsgTimeout):
"""Must be used with 'yield', as
'yield scheduler.close_peer("loc")'.
Close peer at 'location'.
"""
if isinstance(location, Location):
_Peer._lock.acquire()
peer = _Peer.peers.get((location.addr, location.port), None)
_Peer._lock.release()
if peer:
def sys_proc(peer, timeout, done, task=None):
yield _Peer.close_peer(peer, timeout=timeout, task=task)
done.set()
event = Event()
SysTask(sys_proc, peer, timeout, event)
yield event.wait()
评论列表
文章目录