mirror of https://github.com/fail2ban/fail2ban
code review
parent
361c220846
commit
286ef6aa87
|
@ -324,7 +324,7 @@ class Actions(JailThread, Mapping):
|
||||||
datetime.datetime.fromtimestamp(bendtime).strftime("%Y-%m-%d %H:%M:%S"))
|
datetime.datetime.fromtimestamp(bendtime).strftime("%Y-%m-%d %H:%M:%S"))
|
||||||
# check ban is not too old :
|
# check ban is not too old :
|
||||||
if bendtime < MyTime.time():
|
if bendtime < MyTime.time():
|
||||||
logSys.info('[%s] Ignore %s, expiered bantime - %s', self._jail.name, ip, logtime[1])
|
logSys.info('[%s] Ignore %s, expired bantime - %s', self._jail.name, ip, logtime[1])
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
logtime = ('permanent', 'infinite')
|
logtime = ('permanent', 'infinite')
|
||||||
|
|
|
@ -245,12 +245,13 @@ class ObserverThread(JailThread):
|
||||||
logSys.info("Observer stop ... try to end queue %s seconds", wtime)
|
logSys.info("Observer stop ... try to end queue %s seconds", wtime)
|
||||||
#print("Observer stop ....")
|
#print("Observer stop ....")
|
||||||
# just add shutdown job to make possible wait later until full (events remaining)
|
# just add shutdown job to make possible wait later until full (events remaining)
|
||||||
self.add_wn('shutdown')
|
with self._queue_lock:
|
||||||
#don't pulse - just set, because we will delete it hereafter (sometimes not wakeup)
|
self.add_wn('shutdown')
|
||||||
n = self._notify
|
#don't pulse - just set, because we will delete it hereafter (sometimes not wakeup)
|
||||||
self._notify.set()
|
n = self._notify
|
||||||
#self.pulse_notify()
|
self._notify.set()
|
||||||
self._notify = None
|
#self.pulse_notify()
|
||||||
|
self._notify = None
|
||||||
# wait max wtime seconds until full (events remaining)
|
# wait max wtime seconds until full (events remaining)
|
||||||
self.wait_empty(wtime)
|
self.wait_empty(wtime)
|
||||||
n.clear()
|
n.clear()
|
||||||
|
@ -269,9 +270,10 @@ class ObserverThread(JailThread):
|
||||||
if sleeptime is not None:
|
if sleeptime is not None:
|
||||||
e = MyTime.time() + sleeptime
|
e = MyTime.time() + sleeptime
|
||||||
# block queue with not operation to be sure all really jobs are executed if nop goes from queue :
|
# block queue with not operation to be sure all really jobs are executed if nop goes from queue :
|
||||||
self.add_wn('nop')
|
if self._notify is not None:
|
||||||
if self.is_full and self.idle:
|
self.add_wn('nop')
|
||||||
self.pulse_notify()
|
if self.is_full and self.idle:
|
||||||
|
self.pulse_notify()
|
||||||
while self.is_full:
|
while self.is_full:
|
||||||
if sleeptime is not None and MyTime.time() > e:
|
if sleeptime is not None and MyTime.time() > e:
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue