only stop the port/socket if one exists

add a start_reactor=True param to the start method
This commit is contained in:
Damien Churchill 2009-08-03 19:23:27 +00:00
commit c0ce36b216

View file

@ -466,14 +466,15 @@ class DelugeWeb(component.Component):
return 1
SetConsoleCtrlHandler(win_handler)
def start(self):
def start(self, start_reactor=True):
log.info("%s %s.", _("Starting server in PID"), os.getpid())
if self.https:
self.start_ssl()
else:
self.start_normal()
self.plugins.enable_plugins()
if start_reactor:
reactor.run()
def start_normal(self):
@ -491,6 +492,7 @@ class DelugeWeb(component.Component):
self.plugins.disable_plugins()
log.debug("Saving configuration file")
self.config.save()
if self.socket:
self.socket.stopListening()
self.socket = None