only stop the port/socket if one exists
add a start_reactor=True param to the start method
This commit is contained in:
parent
76587be1a7
commit
c0ce36b216
@ -466,15 +466,16 @@ class DelugeWeb(component.Component):
|
|||||||
return 1
|
return 1
|
||||||
SetConsoleCtrlHandler(win_handler)
|
SetConsoleCtrlHandler(win_handler)
|
||||||
|
|
||||||
def start(self):
|
def start(self, start_reactor=True):
|
||||||
log.info("%s %s.", _("Starting server in PID"), os.getpid())
|
log.info("%s %s.", _("Starting server in PID"), os.getpid())
|
||||||
if self.https:
|
if self.https:
|
||||||
self.start_ssl()
|
self.start_ssl()
|
||||||
else:
|
else:
|
||||||
self.start_normal()
|
self.start_normal()
|
||||||
|
|
||||||
self.plugins.enable_plugins()
|
self.plugins.enable_plugins()
|
||||||
reactor.run()
|
|
||||||
|
if start_reactor:
|
||||||
|
reactor.run()
|
||||||
|
|
||||||
def start_normal(self):
|
def start_normal(self):
|
||||||
self.socket = reactor.listenTCP(self.port, self.site)
|
self.socket = reactor.listenTCP(self.port, self.site)
|
||||||
@ -491,8 +492,9 @@ class DelugeWeb(component.Component):
|
|||||||
self.plugins.disable_plugins()
|
self.plugins.disable_plugins()
|
||||||
log.debug("Saving configuration file")
|
log.debug("Saving configuration file")
|
||||||
self.config.save()
|
self.config.save()
|
||||||
self.socket.stopListening()
|
if self.socket:
|
||||||
self.socket = None
|
self.socket.stopListening()
|
||||||
|
self.socket = None
|
||||||
|
|
||||||
def shutdown(self, *args):
|
def shutdown(self, *args):
|
||||||
self.stop()
|
self.stop()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user