#NEWLINE# def shutdown( self , reason = ConnectionClosed ( ) ) : #NEWLINE# #INDENT# 'Shutdown the socket server.\n\n        The socket server will stop accepting incoming connections.\n\n        All connections will be dropped.\n\n        ' #NEWLINE# if self . _shutdown : #NEWLINE# #INDENT# raise ShutdownError ( ) #NEWLINE# #UNINDENT# self . stop ( ) #NEWLINE# self . _closing = True #NEWLINE# for connection in self . connections : #NEWLINE# #INDENT# connection . close ( ) #NEWLINE# #UNINDENT# self . connections = set ( ) #NEWLINE# self . _shutdown = True #NEWLINE# if isinstance ( connection , ConnectionClosed ) : #NEWLINE# #INDENT# logger . info ( 'server shutdown' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logger . warn ( ( 'server shutdown, reason %s' % str ( reason ) ) )