1
0
Fork 0
mirror of https://github.com/de2tla2f/pymaster.git synced 2024-11-30 14:51:28 +00:00

server_entry: save time when we sent challenge

This commit is contained in:
a1batross 2022-12-07 20:03:24 +01:00
parent 4fa50a3bd0
commit 3cbb519ccb

View file

@ -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:
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