Changeset 1818
- Timestamp:
- 11/07/07 18:13:00
- Files:
-
- trunk/cherrypy/restsrv/restd.py (modified) (1 diff)
- trunk/cherrypy/restsrv/servers.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/restsrv/restd.py
r1644 r1818 47 47 __import__(opts['--project'], {}, {}, ['']) 48 48 _import.priority = 20 49 restsrv. engine.subscribe('start', _import)49 restsrv.bus.subscribe('start', _import) 50 50 51 51 if 'win' not in sys.platform: 52 restsrv. engine.subscribe('start', restsrv.plugins.daemonize)52 restsrv.bus.subscribe('start', restsrv.plugins.daemonize) 53 53 54 restsrv. engine.start()55 restsrv. engine.block()54 restsrv.bus.start() 55 restsrv.bus.block() 56 56 57 57 trunk/cherrypy/restsrv/servers.py
r1817 r1818 29 29 30 30 31 def __init__(self, engine):32 self. engine = engine31 def __init__(self, bus): 32 self.bus = bus 33 33 self.httpservers = {} 34 34 self.interrupt = None 35 35 36 36 def subscribe(self): 37 self. engine.subscribe('start', self.start)38 self. engine.subscribe('stop', self.stop)37 self.bus.subscribe('start', self.start) 38 self.bus.subscribe('stop', self.stop) 39 39 40 40 def start(self): … … 62 62 63 63 self.wait(httpserver) 64 self. engine.log("Serving on %s" % on_what)64 self.bus.log("Serving on %s" % on_what) 65 65 66 66 def _start_http_thread(self, httpserver): … … 68 68 main thread persists to receive KeyboardInterrupt's. If an 69 69 exception is raised in the httpserver's thread then it's 70 trapped here, and the engine(and therefore our httpservers)70 trapped here, and the bus (and therefore our httpservers) 71 71 are shut down. 72 72 """ … … 74 74 httpserver.start() 75 75 except KeyboardInterrupt, exc: 76 self. engine.log("<Ctrl-C> hit: shutting down HTTP servers")76 self.bus.log("<Ctrl-C> hit: shutting down HTTP servers") 77 77 self.interrupt = exc 78 self. engine.stop()78 self.bus.stop() 79 79 except SystemExit, exc: 80 self. engine.log("SystemExit raised: shutting down HTTP servers")80 self.bus.log("SystemExit raised: shutting down HTTP servers") 81 81 self.interrupt = exc 82 self. engine.stop()82 self.bus.stop() 83 83 raise 84 84 except: 85 85 import sys 86 86 self.interrupt = sys.exc_info()[1] 87 self. engine.log("Error in HTTP server: shutting down",87 self.bus.log("Error in HTTP server: shutting down", 88 88 traceback=True) 89 self. engine.stop()89 self.bus.stop() 90 90 raise 91 91 … … 119 119 if isinstance(bind_addr, tuple): 120 120 wait_for_free_port(*bind_addr) 121 self. engine.log("HTTP Server %s shut down" % httpserver)121 self.bus.log("HTTP Server %s shut down" % httpserver) 122 122 123 123 def restart(self):

