Changeset 725198
- Timestamp:
- 04/27/2009 06:46:30 PM (16 years ago)
- Branches:
- 2.0.x, develop, extjs4-port, master
- Children:
- 2ac545d
- Parents:
- 9f2b98
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
deluge/ui/web/server.py
r9f2b98 r725198 27 27 import locale 28 28 import shutil 29 import signal 29 30 import signal 30 31 import urllib … … 349 350 # use of it. 350 351 reactor.addSystemEventTrigger("after", "shutdown", self.shutdown) 352 353 # Twisted doesn't handle windows specific signals so we still 354 # need to attach to those to handle the close correctly. 355 if common.windows_check(): 356 from win32api import SetConsoleCtrlHandler 357 from win32con import CTRL_CLOSE_EVENT, CTRL_SHUTDOWN_EVENT 358 def win_handler(ctrl_type): 359 log.debug("ctrl type: %s", ctrl_type) 360 if ctrl_type == CTRL_CLOSE_EVENT or \ 361 ctrl_type == CTRL_SHUTDOWN_EVENT: 362 self.shutdown() 363 return 1 364 SetConsoleCtrlHandler(win_handler) 351 365 352 366 # Initalize the plugins … … 360 374 reactor.run() 361 375 362 def shutdown(self ):376 def shutdown(self, *args): 363 377 log.info("Shutting down webserver") 364 378 log.debug("Saving configuration file") 365 379 self.config.save() 380 try: 381 reactor.stop() 382 except error.ReactorNotRunning: 383 log.debug("Reactor not running") 366 384 367 385 if __name__ == "__builtin__":
Note:
See TracChangeset
for help on using the changeset viewer.