Mercurial > libervia-web
comparison libervia/server/server.py @ 1236:352e189ab7f8
server: avoid double init
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 10 Jan 2020 10:26:59 +0100 |
parents | 40c13ba6ba94 |
children | 987595a254b0 |
comparison
equal
deleted
inserted
replaced
1235:40c13ba6ba94 | 1236:352e189ab7f8 |
---|---|
606 class Libervia(service.Service): | 606 class Libervia(service.Service): |
607 debug = defer.Deferred.debug # True if twistd/Libervia is launched in debug mode | 607 debug = defer.Deferred.debug # True if twistd/Libervia is launched in debug mode |
608 | 608 |
609 def __init__(self, options): | 609 def __init__(self, options): |
610 self.options = options | 610 self.options = options |
611 | |
612 def _init(self): | |
613 # we do init here and not in __init__ to avoid doule initialisation with twistd | |
614 # this _init is called in startService | |
611 self.initialised = defer.Deferred() | 615 self.initialised = defer.Deferred() |
612 self.waiting_profiles = WaitingRequests() # FIXME: should be removed | 616 self.waiting_profiles = WaitingRequests() # FIXME: should be removed |
613 self._main_conf = None | 617 self._main_conf = None |
614 self.files_watcher = FilesWatcher(self) | 618 self.files_watcher = FilesWatcher(self) |
615 | 619 |
1212 @param **kwargs: list of keyword arguments of the callback""" | 1216 @param **kwargs: list of keyword arguments of the callback""" |
1213 self._cleanup.insert(0, (callback, args, kwargs)) | 1217 self._cleanup.insert(0, (callback, args, kwargs)) |
1214 | 1218 |
1215 def startService(self): | 1219 def startService(self): |
1216 """Connect the profile for Libervia and start the HTTP(S) server(s)""" | 1220 """Connect the profile for Libervia and start the HTTP(S) server(s)""" |
1221 self._init() | |
1217 | 1222 |
1218 def eb(e): | 1223 def eb(e): |
1219 log.error(_("Connection failed: %s") % e) | 1224 log.error(_("Connection failed: %s") % e) |
1220 self.stop() | 1225 self.stop() |
1221 | 1226 |