summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyril Jaquier <cyril.jaquier@fail2ban.org>2006-09-17 22:53:59 +0000
committerCyril Jaquier <cyril.jaquier@fail2ban.org>2006-09-17 22:53:59 +0000
commitacb2fc2c2b151665884798e7cc60c9072a2c58b0 (patch)
treebd4f236427f96f56a78c3d4ebf0625c4fd2efa7b
parent0d68fc9ef1ecd73b7533739bd8cbf70e09d8608c (diff)
downloadfail2ban-acb2fc2c2b151665884798e7cc60c9072a2c58b0.tar.gz
- Fixes in locking
git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@366 a942ae1a-1317-0410-a47c-b1dcaea8d605
-rw-r--r--server/banmanager.py16
-rw-r--r--server/jail.py2
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