various bug fixes related to Swarm integration

This commit is contained in:
florian
2021-08-12 22:53:07 +02:00
parent 4a9d64d9d9
commit b199464a73
5 changed files with 18 additions and 14 deletions

View File

@@ -33,6 +33,7 @@ class Config :
try :
# Lock
if self.__lock :
log("config", "ERROR", "lock")
self.__lock.acquire()
locked = True
@@ -46,6 +47,7 @@ class Config :
# Unlock
if self.__lock :
log("config", "ERROR", "release")
self.__lock.release()
locked = False
@@ -136,6 +138,7 @@ class Config :
def __api_call(self, instances, path) :
if self.__lock :
log("config", "ERROR", "lock")
self.__lock.acquire()
ret = True
nb = 0
@@ -172,5 +175,6 @@ class Config :
log("config", "INFO", "failed API order to " + url)
ret = False
if self.__lock :
log("config", "ERROR", "release")
self.__lock.release()
return ret and nb > 0

View File

@@ -13,10 +13,12 @@ class ReloadServerHandler(socketserver.StreamRequestHandler):
if not data or not data in [b"lock", b"reload", b"unlock"] :
break
if data == b"lock" :
log("RELOADSERVER", "ERROR", "lock")
self.server.controller.lock.acquire()
locked = True
self.request.sendall(b"ok")
elif data == b"unlock" :
log("RELOADSERVER", "ERROR", "unlock")
self.server.controller.lock.release()
locked = False
self.request.sendall(b"ok")