Browse Source

server_entry: save time when we sent challenge

master
a1batross 2 years ago
parent
commit
3cbb519ccb
  1. 15
      server_entry.py

15
server_entry.py

@ -18,7 +18,7 @@ class ServerEntry: @@ -18,7 +18,7 @@ class ServerEntry:
region = 255
product = ''
nat = 0
def setInfoString(self, data):
infostring = data.replace('\n', '').replace('\r', '').replace('\0', '')
split = infostring.split('\\')
@ -60,24 +60,25 @@ class ServerEntry: @@ -60,24 +60,25 @@ class ServerEntry:
except IndexError:
pass
self.check = self.challenge == self.challenge2
return self.check
def __init__(self, addr, challenge):
# Address
self.addr = addr
# Shortcuts for generating query
self.queryAddr = b''
for i in addr[0].split('.'):
self.queryAddr += pack('!B', int(i))
self.queryAddr += pack('!H', int(addr[1]))
# Random number that server must return
# Random number that server must return
self.challenge = challenge
self.sentChallengeAt = time()
# This server is not checked
# So it will not get into queries
self.check = False
# Remove server after this time.
# This maybe not instant
self.die = time() + 600.0
self.die = self.sentChallengeAt + 600

Loading…
Cancel
Save