Package schrodinger :: Package application :: Package glide :: Package packages :: Module sp_filter :: Class CutoffHTTPServer
[hide private]
[frames] | no frames]

Class CutoffHTTPServer

SocketServer.BaseServer --+        
                          |        
     SocketServer.TCPServer --+    
                              |    
      BaseHTTPServer.HTTPServer --+
                                  |
                                 CutoffHTTPServer

HTTPServer subclass that also keeps track of a CutoffCalculator and provides a mechanism for the request handler to tell the server to stop.

Instance Methods [hide private]
 
__init__(self, calc, server_id, server_address, timeout=None)
Constructor.
 
handle_timeout(self)
Handle a timeout situation by setting the internal flag that tells the server to stop.
 
serve_until_stopped(self)
Process requests until the server times out or a request handler sets self.cutoff_stop to a True value.

Inherited from BaseHTTPServer.HTTPServer: server_bind

Inherited from SocketServer.TCPServer: close_request, fileno, get_request, server_activate, server_close, shutdown_request

Inherited from SocketServer.BaseServer: finish_request, handle_error, handle_request, process_request, serve_forever, shutdown, verify_request

Inherited from SocketServer.BaseServer (private): _handle_request_noblock

Class Variables [hide private]

Inherited from BaseHTTPServer.HTTPServer: allow_reuse_address

Inherited from SocketServer.TCPServer: address_family, request_queue_size, socket_type

Inherited from SocketServer.BaseServer: timeout

Method Details [hide private]

__init__(self, calc, server_id, server_address, timeout=None)
(Constructor)

 

Constructor. May be extended, do not override.

Parameters:
  • calc (CutoffCalculator) - calculator object
  • server_id (str) - unique server ID to prevent a client from talking to the wrong server.
  • server_address ((str, int)) - tuple of (host, port)
  • timeout (int or NoneType) - shut down the server after this time is exceeded without any requests (None means no timeout)
Overrides: SocketServer.BaseServer.__init__

handle_timeout(self)

 

Handle a timeout situation by setting the internal flag that tells the server to stop.

Overrides: SocketServer.BaseServer.handle_timeout