#NEWLINE# def start( self ) : #NEWLINE# #INDENT# 'Start serving a WSGI application.\n\n        :returns: None\n        ' #NEWLINE# dup_socket = self . _socket . dup ( ) #NEWLINE# dup_socket . setsockopt ( socket . SOL_SOCKET , socket . SO_REUSEADDR , 1 ) #NEWLINE# dup_socket . setsockopt ( socket . SOL_SOCKET , socket . SO_KEEPALIVE , 1 ) #NEWLINE# if hasattr ( socket , 'TCP_KEEPIDLE' ) : #NEWLINE# #INDENT# dup_socket . setsockopt ( socket . IPPROTO_TCP , socket . TCP_KEEPIDLE , CONF . wsgi . tcp_keepidle ) #NEWLINE# #UNINDENT# if self . _use_ssl : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# ca_file = CONF . wsgi . ssl_ca_file #NEWLINE# cert_file = CONF . wsgi . ssl_cert_file #NEWLINE# key_file = CONF . wsgi . ssl_key_file #NEWLINE# if ( cert_file and ( not os . path . exists ( cert_file ) ) ) : #NEWLINE# #INDENT# raise RuntimeError ( ( _ ( 'Unable to find cert_file : %s' ) % cert_file ) ) #NEWLINE# #UNINDENT# if ( ca_file and ( not os . path . exists ( ca_file ) ) ) : #NEWLINE# #INDENT# raise RuntimeError ( ( _ ( 'Unable to find ca_file : %s' ) % ca_file ) ) #NEWLINE# #UNINDENT# if ( key_file and ( not os . path . exists ( key_file ) ) ) : #NEWLINE# #INDENT# raise RuntimeError ( ( _ ( 'Unable to find key_file : %s' ) % ca_file ) ) #NEWLINE# #UNINDENT# if ( self . _use_ssl and ( ( not cert_file ) or ( not key_file ) ) ) : #NEWLINE# #INDENT# raise RuntimeError ( _ ( 'When running server in SSL mode, you must specify both a cert_file and key_file option value in your configuration file' ) ) #NEWLINE# #UNINDENT# ssl_kwargs = { #NEWLINE# #INDENT# 'server_side' : True , #NEWLINE# 'certfile' : cert_file , #NEWLINE# 'keyfile' : key_file , #NEWLINE# 'cert_reqs' : ssl . CERT_NONE , #NEWLINE# #UNINDENT# } #NEWLINE# if CONF . wsgi . ssl_ca_file : #NEWLINE# #INDENT# ssl_kwargs [ 'ca_certs' ] = ca_file #NEWLINE# ssl_kwargs [ 'cert_reqs' ] = ssl . CERT_REQUIRED #NEWLINE# #UNINDENT# dup_socket = eventlet . wrap_ssl ( dup_socket , ** ssl_kwargs ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# with excutils . save_and_reraise_exception ( ) : #NEWLINE# #INDENT# LOG . error ( _LE ( 'Failed to start %(name)s on %(host)s:%(port)s with SSL support' ) , { #NEWLINE# #INDENT# 'name' : self . name , #NEWLINE# 'host' : self . host , #NEWLINE# 'port' : self . port , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# wsgi_kwargs = { #NEWLINE# #INDENT# 'func' : eventlet . wsgi . server , #NEWLINE# 'sock' : dup_socket , #NEWLINE# 'site' : self . app , #NEWLINE# 'protocol' : self . _protocol , #NEWLINE# 'custom_pool' : self . _pool , #NEWLINE# 'log' : self . _logger , #NEWLINE# 'log_format' : CONF . wsgi . wsgi_log_format , #NEWLINE# 'debug' : False , #NEWLINE# 'keepalive' : CONF . wsgi . keep_alive , #NEWLINE# 'socket_timeout' : self . client_socket_timeout , #NEWLINE# #UNINDENT# } #NEWLINE# if self . _max_url_len : #NEWLINE# #INDENT# wsgi_kwargs [ 'url_length_limit' ] = self . _max_url_len #NEWLINE# #UNINDENT# self . _server = utils . spawn ( ** wsgi_kwargs )