code review: switch MAX_TIME to 0X7FFFFFFFFFFF (is enough, because 4461763-th year, but better performance)

pull/1557/head
sebres 8 years ago
parent e00be5f308
commit 004879b5b1

@ -57,7 +57,7 @@ class BanManager:
## Total number of banned IP address
self.__banTotal = 0
## The time for next unban process (for performance and load reasons):
self.__nextUnbanTime = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFL
self.__nextUnbanTime = BanTicket.MAX_TIME
##
# Set the ban time.
@ -322,7 +322,7 @@ class BanManager:
# Gets the list of ticket to remove (thereby correct next unban time).
unBanList = {}
self.__nextUnbanTime = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFL
self.__nextUnbanTime = BanTicket.MAX_TIME
for fid,ticket in self.__banList.iteritems():
# current time greater as end of ban - timed out:
eob = ticket.getEndOfBanTime(self.__banTime)

@ -35,6 +35,8 @@ logSys = getLogger(__name__)
class Ticket(object):
MAX_TIME = 0X7FFFFFFFFFFF ;# 4461763-th year
RESTORED = 0x01
BANNED = 0x08
@ -112,7 +114,7 @@ class Ticket(object):
bantime = (self._banTime if self._banTime is not None else defaultBT)
# permanent
if bantime == -1:
return 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFL
return Ticket.MAX_TIME
# unban time (end of ban):
return self._time + bantime

Loading…
Cancel
Save