mirror of
https://github.com/de2tla2f/pymaster.git
synced 2024-11-22 11:01:27 +00:00
Workaround client related bug
This commit is contained in:
parent
cbc9fc0883
commit
def879f91c
10
pymaster.py
10
pymaster.py
|
@ -60,8 +60,6 @@ class PyMaster:
|
||||||
logPrint("Unknown message: {0} from {1}:{2}".format(data, addr[0], addr[1]))
|
logPrint("Unknown message: {0} from {1}:{2}".format(data, addr[0], addr[1]))
|
||||||
|
|
||||||
def clientQuery(self, data, addr):
|
def clientQuery(self, data, addr):
|
||||||
logPrint("Client Query: from {0}:{1}".format(addr[0], addr[1]))
|
|
||||||
|
|
||||||
region = data[1] # UNUSED
|
region = data[1] # UNUSED
|
||||||
data = data.strip('1' + region)
|
data = data.strip('1' + region)
|
||||||
try:
|
try:
|
||||||
|
@ -92,7 +90,7 @@ class PyMaster:
|
||||||
logPrint('Unhandled info string entry: {0}/{1}'.format(split[i], key))
|
logPrint('Unhandled info string entry: {0}/{1}'.format(split[i], key))
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
packet = MasterProtocol.queryPacketHeader
|
packet = MasterProtocol.queryPacketHeader
|
||||||
for i in self.serverList:
|
for i in self.serverList:
|
||||||
if( time() > i.die ):
|
if( time() > i.die ):
|
||||||
|
@ -108,7 +106,7 @@ class PyMaster:
|
||||||
|
|
||||||
# Use pregenerated address string
|
# Use pregenerated address string
|
||||||
packet += i.queryAddr
|
packet += i.queryAddr
|
||||||
logPrint('Append server to answer: {0}:{1}'.format(i.addr[0], i.addr[1]))
|
packet += b'\0\0\0\0\0\0' # Fill last IP:Port with \0
|
||||||
|
|
||||||
self.sock.sendto(packet, addr)
|
self.sock.sendto(packet, addr)
|
||||||
|
|
||||||
|
@ -150,9 +148,9 @@ class PyMaster:
|
||||||
logPrint("Status Request: from {0}:{1}".format(addr[0], addr[1]))
|
logPrint("Status Request: from {0}:{1}".format(addr[0], addr[1]))
|
||||||
count = len(self.serverList)
|
count = len(self.serverList)
|
||||||
|
|
||||||
packet = b'Server\t\t\tGame\tMap\tPlayers\tVersion\tChallenge\tCheck\n'
|
packet = b'Server\t\t\tGame\tMap\t\tPlayers\tVersion\tChallenge\tCheck\n'
|
||||||
for i in self.serverList:
|
for i in self.serverList:
|
||||||
line = '{0}:{1}\t{2}\t{3}\t{4}/{5}\t{6}\n'.format(i.addr[0], i.addr[1],
|
line = '{0}:{1}\t{2}\t{3}\t\t{4}/{5}\t{6}\t{7}\t{8}n'.format(i.addr[0], i.addr[1],
|
||||||
i.gamedir, i.gamemap, i.players,
|
i.gamedir, i.gamemap, i.players,
|
||||||
i.maxplayers, i.version, i.challenge, i.check)
|
i.maxplayers, i.version, i.challenge, i.check)
|
||||||
packet += line.encode('latin_1')
|
packet += line.encode('latin_1')
|
||||||
|
|
Loading…
Reference in a new issue