mirror of https://github.com/fail2ban/fail2ban
attempt to speedup ban- and fail-manager (e. g. fail2ban-client status, see gh-2819), remove unneeded lock (GIL is enough here)
parent
a038fd5dfe
commit
f555ff45e9
|
@ -66,7 +66,6 @@ class BanManager:
|
|||
# @param value the time
|
||||
|
||||
def setBanTime(self, value):
|
||||
with self.__lock:
|
||||
self.__banTime = int(value)
|
||||
|
||||
##
|
||||
|
@ -76,7 +75,6 @@ class BanManager:
|
|||
# @return the time
|
||||
|
||||
def getBanTime(self):
|
||||
with self.__lock:
|
||||
return self.__banTime
|
||||
|
||||
##
|
||||
|
@ -85,7 +83,6 @@ class BanManager:
|
|||
# @param value total number
|
||||
|
||||
def setBanTotal(self, value):
|
||||
with self.__lock:
|
||||
self.__banTotal = value
|
||||
|
||||
##
|
||||
|
@ -94,7 +91,6 @@ class BanManager:
|
|||
# @return the total number
|
||||
|
||||
def getBanTotal(self):
|
||||
with self.__lock:
|
||||
return self.__banTotal
|
||||
|
||||
##
|
||||
|
@ -103,7 +99,6 @@ class BanManager:
|
|||
# @return IP list
|
||||
|
||||
def getBanList(self):
|
||||
with self.__lock:
|
||||
return list(self.__banList.keys())
|
||||
|
||||
##
|
||||
|
@ -112,8 +107,7 @@ class BanManager:
|
|||
# @return ban list iterator
|
||||
|
||||
def __iter__(self):
|
||||
# ensure iterator is safe (traverse over the list in snapshot created within lock):
|
||||
with self.__lock:
|
||||
# ensure iterator is safe - traverse over the list in snapshot created within lock (GIL):
|
||||
return iter(list(self.__banList.values()))
|
||||
|
||||
##
|
||||
|
|
|
@ -47,11 +47,9 @@ class FailManager:
|
|||
self.__bgSvc = BgService()
|
||||
|
||||
def setFailTotal(self, value):
|
||||
with self.__lock:
|
||||
self.__failTotal = value
|
||||
|
||||
def getFailTotal(self):
|
||||
with self.__lock:
|
||||
return self.__failTotal
|
||||
|
||||
def getFailCount(self):
|
||||
|
@ -123,7 +121,6 @@ class FailManager:
|
|||
return attempts
|
||||
|
||||
def size(self):
|
||||
with self.__lock:
|
||||
return len(self.__failList)
|
||||
|
||||
def cleanup(self, time):
|
||||
|
|
Loading…
Reference in New Issue