mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-04 15:38:43 +00:00
[WebUI] Fix #2798: WebUI plugin fails to start
This commit is contained in:
parent
092d496944
commit
64c67a07dd
2 changed files with 22 additions and 5 deletions
|
@ -71,7 +71,7 @@ class Core(CorePluginBase):
|
||||||
|
|
||||||
self.server.port = self.config["port"]
|
self.server.port = self.config["port"]
|
||||||
self.server.https = self.config["ssl"]
|
self.server.https = self.config["ssl"]
|
||||||
self.server.start(False)
|
self.server.start(standalone=False)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@export
|
@export
|
||||||
|
|
|
@ -544,7 +544,7 @@ class DelugeWeb(component.Component):
|
||||||
self.base = self.config["base"]
|
self.base = self.config["base"]
|
||||||
self.web_api = WebApi()
|
self.web_api = WebApi()
|
||||||
self.auth = Auth(self.config)
|
self.auth = Auth(self.config)
|
||||||
|
self.standalone = True
|
||||||
# Initalize the plugins
|
# Initalize the plugins
|
||||||
self.plugins = PluginManager()
|
self.plugins = PluginManager()
|
||||||
|
|
||||||
|
@ -567,14 +567,30 @@ class DelugeWeb(component.Component):
|
||||||
return 1
|
return 1
|
||||||
SetConsoleCtrlHandler(win_handler)
|
SetConsoleCtrlHandler(win_handler)
|
||||||
|
|
||||||
def start(self):
|
def start(self, standalone=True):
|
||||||
|
"""
|
||||||
|
Start the DelugeWeb server
|
||||||
|
|
||||||
|
When running WebUI plugin, the server must not try to start
|
||||||
|
the twisted reactor.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
standalone (bool): Whether the server runs as a standalone process
|
||||||
|
If standalone, start twisted reactor.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Deferred
|
||||||
|
"""
|
||||||
log.info("%s %s.", _("Starting server in PID"), os.getpid())
|
log.info("%s %s.", _("Starting server in PID"), os.getpid())
|
||||||
|
self.standalone = standalone
|
||||||
if self.https:
|
if self.https:
|
||||||
self.start_ssl()
|
self.start_ssl()
|
||||||
else:
|
else:
|
||||||
self.start_normal()
|
self.start_normal()
|
||||||
|
|
||||||
component.get("Web").enable()
|
component.get("Web").enable()
|
||||||
|
|
||||||
|
if self.standalone:
|
||||||
reactor.run()
|
reactor.run()
|
||||||
|
|
||||||
def start_normal(self):
|
def start_normal(self):
|
||||||
|
@ -613,6 +629,7 @@ class DelugeWeb(component.Component):
|
||||||
|
|
||||||
def shutdown(self, *args):
|
def shutdown(self, *args):
|
||||||
self.stop()
|
self.stop()
|
||||||
|
if self.standalone:
|
||||||
reactor.stop()
|
reactor.stop()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue