def shutdown(self, details=None):
'''
Exit the main loop and write a last exit message on all connections
before closing them. The exit message will be serialized as an ``Exit``
exception.
'''
# close all open connections
for connection in self.accepting:
connection.close()
for connection in self.authenticating:
if details:
self.write_exit_message(connection, details)
connection.close()
for connection in self.established:
if details:
self.write_exit_message(connection, details)
connection.close()
if self.listener:
self.listener.close()
self.join_deferred()
os._exit(1) # causes queued messages on outbound sockets to be flushed
# in the background. Man page: socket(7) SO_LINGER
评论列表
文章目录