def disconnect(self, *, wait=True, timeout=2.0):
for cid, ch in list(self.channels.items()):
ch.disconnect(wait=wait, timeout=timeout)
self.channels.pop(cid)
with self.new_command_cond:
self.circuit.disconnect()
sock = self.socket
if sock is not None:
self.selector.remove_socket(sock)
try:
sock.shutdown(socket.SHUT_WR)
sock.close()
except OSError:
pass
self.socket = None
self.channels.clear()
self.ioids.clear()
评论列表
文章目录