diff options
-rw-r--r-- | server/banmanager.py | 16 | ||||
-rw-r--r-- | server/jail.py | 2 |
2 files changed, 7 insertions, 11 deletions
diff --git a/server/banmanager.py b/server/banmanager.py index 252fac3a..bd731e38 100644 --- a/server/banmanager.py +++ b/server/banmanager.py @@ -110,16 +110,12 @@ class BanManager: @staticmethod def createBanTicket(ticket): - try: - self.lock.acquire() - ip = ticket.getIP() - #lastTime = ticket.getTime() - lastTime = time.time() - banTicket = BanTicket(ip, lastTime) - banTicket.setAttempt(ticket.getAttempt()) - return banTicket - finally: - self.lock.release() + ip = ticket.getIP() + #lastTime = ticket.getTime() + lastTime = time.time() + banTicket = BanTicket(ip, lastTime) + banTicket.setAttempt(ticket.getAttempt()) + return banTicket ## # Add a ban ticket. diff --git a/server/jail.py b/server/jail.py index b48dea20..359d08d4 100644 --- a/server/jail.py +++ b/server/jail.py @@ -92,8 +92,8 @@ class Jail: def getFailTicket(self): try: + self.lock.acquire() try: - self.lock.acquire() return self.queue.get(False) except Queue.Empty: return False |