Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 889

Show
Ignore:
Timestamp:
12/28/05 17:05:53
Author:
fumanchu
Message:

server.wait now checks for server.interrupt, so start_with_callback won't hang on error in server.start.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/_cpserver.py

    r871 r889  
    22 
    33import cgi 
     4import sys 
    45import threading 
    56import time 
     
    111112            cherrypy.log("SystemExit raised: shutting down server", "HTTP") 
    112113            self.stop() 
     114        except: 
     115            # Don't bother logging, since we're going to re-raise. 
     116            self.interrupt = sys.exc_info()[1] 
     117            self.stop() 
     118            raise 
    113119     
    114120    def start_http_server(self, blocking=True): 
     
    233239     
    234240    def wait(self): 
    235         """Block the caller until ready to receive requests.""" 
     241        """Block the caller until ready to receive requests (or error).""" 
    236242        while not self.ready: 
    237243            time.sleep(.1) 
     244            if self.interrupt: 
     245                # Something went wrong in server.start, 
     246                # possibly in another thread. Stop this thread. 
     247                raise cherrypy.NotReady("The CherryPy server errored", "HTTP") 
    238248     
    239249    def _is_ready(self): 
    240250        return bool(self.state == STARTED) 
    241     ready = property(_is_ready, doc="Return True if the server is ready to receive requests, False otherwise.") 
     251    ready = property(_is_ready, doc="Return True if the server is ready to" 
     252                                    " receive requests, False otherwise.") 
    242253     
    243254    def start_with_callback(self, func, args=None, kwargs=None, 

Hosted by WebFaction

Log in as guest/cpguest to create tickets