Fix lock over pathod locks
There were basically a nop before... o_O
This commit is contained in:
parent
ffca395e48
commit
29bcdc8250
|
@ -353,6 +353,8 @@ class Pathod(tcp.TCPServer):
|
||||||
staticdir=self.staticdir
|
staticdir=self.staticdir
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.loglock = threading.Lock()
|
||||||
|
|
||||||
def check_policy(self, req, settings):
|
def check_policy(self, req, settings):
|
||||||
"""
|
"""
|
||||||
A policy check that verifies the request size is within limits.
|
A policy check that verifies the request size is within limits.
|
||||||
|
@ -403,8 +405,7 @@ class Pathod(tcp.TCPServer):
|
||||||
|
|
||||||
def add_log(self, d):
|
def add_log(self, d):
|
||||||
if not self.noapi:
|
if not self.noapi:
|
||||||
lock = threading.Lock()
|
with self.loglock:
|
||||||
with lock:
|
|
||||||
d["id"] = self.logid
|
d["id"] = self.logid
|
||||||
self.log.insert(0, d)
|
self.log.insert(0, d)
|
||||||
if len(self.log) > self.LOGBUF:
|
if len(self.log) > self.LOGBUF:
|
||||||
|
@ -413,17 +414,18 @@ class Pathod(tcp.TCPServer):
|
||||||
return d["id"]
|
return d["id"]
|
||||||
|
|
||||||
def clear_log(self):
|
def clear_log(self):
|
||||||
lock = threading.Lock()
|
with self.loglock:
|
||||||
with lock:
|
|
||||||
self.log = []
|
self.log = []
|
||||||
|
|
||||||
def log_by_id(self, identifier):
|
def log_by_id(self, identifier):
|
||||||
for i in self.log:
|
with self.loglock:
|
||||||
if i["id"] == identifier:
|
for i in self.log:
|
||||||
return i
|
if i["id"] == identifier:
|
||||||
|
return i
|
||||||
|
|
||||||
def get_log(self):
|
def get_log(self):
|
||||||
return self.log
|
with self.loglock:
|
||||||
|
return self.log
|
||||||
|
|
||||||
|
|
||||||
def main(args): # pragma: no cover
|
def main(args): # pragma: no cover
|
||||||
|
|
Loading…
Reference in New Issue