#NEWLINE# def stop( self ) : #NEWLINE# #INDENT# '\n        Stop the server.\n\n        Halt server client connections and clean up any existing connection\n        threads.\n\n        Raises:\n            NetworkingError: Raised if a failure occurs while sutting down\n                or closing the TLS server socket.\n        ' #NEWLINE# self . _logger . info ( 'Cleaning up remaining connection threads.' ) #NEWLINE# for thread in threading . enumerate ( ) : #NEWLINE# #INDENT# if ( thread is not threading . current_thread ( ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# thread . join ( 10.0 ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# self . _logger . info ( 'Error occurred while attempting to cleanup thread: {0}' . format ( thread . name ) ) #NEWLINE# self . _logger . exception ( e ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if thread . is_alive ( ) : #NEWLINE# #INDENT# self . _logger . warning ( 'Cleanup failed for thread: {0}. Thread is still alive' . format ( e . name ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _logger . info ( 'Cleanup succeeded for thread: {0}' . format ( thread . name ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# self . _logger . info ( 'Shutting down server socket handler.' ) #NEWLINE# try : #NEWLINE# #INDENT# self . _socket . shutdown ( socket . SHUT_RDWR ) #NEWLINE# self . _socket . close ( ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# self . _logger . exception ( e ) #NEWLINE# raise exceptions . NetworkingError ( 'Server failed to shutdown socket handler.' )