Change http server order start

pull/71/head
Nicolas Arenas 2026-04-28 17:57:41 +02:00
parent ee5710fffc
commit 7086cf1467
1 changed files with 8 additions and 7 deletions

View File

@ -146,11 +146,8 @@ class CommonService(object):
self.ipc = ipc.ServerIPC(self.ipcport, clientMessageProcessor=self.clientMessageProcessor) self.ipc = ipc.ServerIPC(self.ipcport, clientMessageProcessor=self.clientMessageProcessor)
self.ipc.start() self.ipc.start()
# And http threaded server # Activate modules before exposing the HTTP server so that no request
self.httpServer = httpserver.HTTPServerThread(self.address, self) # arrives before the secret has been sent to ogcore via ogagent/started.
self.httpServer.start()
# And lastly invoke modules activation
validMods = [] validMods = []
for mod in self.modules: for mod in self.modules:
try: try:
@ -165,6 +162,10 @@ class CommonService(object):
logger.debug('Modules after activation: {}'.format(list(v.name for v in self.modules))) logger.debug('Modules after activation: {}'.format(list(v.name for v in self.modules)))
# Start HTTP server only after all modules are active and ogcore knows the secret.
self.httpServer = httpserver.HTTPServerThread(self.address, self)
self.httpServer.start()
def terminate(self): def terminate(self):
# First invoke deactivate on modules # First invoke deactivate on modules
for mod in reversed(self.modules): for mod in reversed(self.modules):