changeset 1236:352e189ab7f8 default tip @

server: avoid double init
author Goffi <goffi@goffi.org>
date Fri, 10 Jan 2020 10:26:59 +0100
parents 40c13ba6ba94
children
files libervia/server/server.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/server/server.py	Fri Jan 10 10:09:18 2020 +0100
+++ b/libervia/server/server.py	Fri Jan 10 10:26:59 2020 +0100
@@ -608,6 +608,10 @@
 
     def __init__(self, options):
         self.options = options
+
+    def _init(self):
+        # we do init here and not in __init__ to avoid doule initialisation with twistd
+        # this _init is called in startService
         self.initialised = defer.Deferred()
         self.waiting_profiles = WaitingRequests()  # FIXME: should be removed
         self._main_conf = None
@@ -1214,6 +1218,7 @@
 
     def startService(self):
         """Connect the profile for Libervia and start the HTTP(S) server(s)"""
+        self._init()
 
         def eb(e):
             log.error(_("Connection failed: %s") % e)