#NEWLINE# def start( self ) : #NEWLINE# #INDENT# 'Starts the _SingleAddressWsgiServer.\n\n    This is a modified version of the base class implementation. Changes:\n      - Removed unused functionality (Unix domain socket and SSL support).\n      - Raises BindError instead of socket.error.\n      - Uses SharedCherryPyThreadPool instead of wsgiserver.ThreadPool.\n      - Calls _SELECT_THREAD.add_socket instead of looping forever.\n\n    Raises:\n      BindError: The address could not be bound.\n    ' #NEWLINE# ( host , port ) = self . bind_addr #NEWLINE# try : #NEWLINE# #INDENT# info = socket . getaddrinfo ( host , port , socket . AF_UNSPEC , socket . SOCK_STREAM , 0 , socket . AI_PASSIVE ) #NEWLINE# #UNINDENT# except socket . gaierror : #NEWLINE# #INDENT# if ( ':' in host ) : #NEWLINE# #INDENT# info = [ ( socket . AF_INET6 , socket . SOCK_STREAM , 0 , '' , ( self . bind_addr + ( 0 , 0 ) ) ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# info = [ ( socket . AF_INET , socket . SOCK_STREAM , 0 , '' , self . bind_addr ) ] #NEWLINE# #UNINDENT# #UNINDENT# self . socket = None #NEWLINE# for res in info : #NEWLINE# #INDENT# ( af , socktype , proto , _ , _ ) = res #NEWLINE# try : #NEWLINE# #INDENT# self . bind ( af , socktype , proto ) #NEWLINE# #UNINDENT# except socket . error as socket_error : #NEWLINE# #INDENT# if self . socket : #NEWLINE# #INDENT# self . socket . close ( ) #NEWLINE# #UNINDENT# self . socket = None #NEWLINE# continue #NEWLINE# #UNINDENT# break #NEWLINE# #UNINDENT# if ( not self . socket ) : #NEWLINE# #INDENT# raise BindError ( ( 'Unable to bind %s:%s' % self . bind_addr ) , socket_error ) #NEWLINE# #UNINDENT# self . socket . settimeout ( 5 ) #NEWLINE# self . socket . listen ( self . request_queue_size ) #NEWLINE# self . ready = True #NEWLINE# self . _start_time = time . time ( ) #NEWLINE# _SELECT_THREAD . add_socket ( self . socket , self . tick )