diff --git a/gamespy_qr_server.py b/gamespy_qr_server.py index 2a46034..6f433ba 100644 --- a/gamespy_qr_server.py +++ b/gamespy_qr_server.py @@ -324,6 +324,11 @@ class GameSpyQRServer(object): be = self.sessions[session_id].console != 0 k['publicip'] = str(utils.get_ip(bytearray([int(x) for x in address[0].split('.')]), 0, be)) + if 'publicport' in k and 'localport' in k and k['publicport'] != k['localport']: + self.log(logging.DEBUG, address, "publicport %s doesn't match localport %s, so changing publicport to %s..." \ + % (k['publicport'], k['localport'], str(address[1]))) + k['publicport'] = str(address[1]) + if "statechanged" in k: if k['statechanged'] == "2": # Close server self.server_manager.delete_server(k['gamename'] , session_id) diff --git a/other/utils.py b/other/utils.py index b53fdfd..26f69a7 100644 --- a/other/utils.py +++ b/other/utils.py @@ -75,6 +75,9 @@ def base32_encode(num, reverse=True): encoded += alpha[num & 0x1f] num = num >> 5 + while len(encoded) < 9: + encoded += "0" + if reverse == True: encoded = encoded[::-1] # Reverse string