mirror of
https://github.com/barronwaffles/dwc_network_server_emulator.git
synced 2026-08-27 21:34:08 -05:00
Don't forward data to port 0
Also made the loop in qr more pythonic.
This commit is contained in:
@@ -269,8 +269,7 @@ class GameSpyQRServer(object):
|
||||
if found_console == False:
|
||||
# Couldn't detect game, try to get it from the database
|
||||
# Try a 3 times before giving up
|
||||
retry = 0
|
||||
while retry < 3:
|
||||
for i in range(0, 3):
|
||||
try:
|
||||
profile = self.db.get_profile_from_profileid(self.sessions[session_id].playerid)
|
||||
|
||||
@@ -279,7 +278,6 @@ class GameSpyQRServer(object):
|
||||
|
||||
break
|
||||
except:
|
||||
retry += 1
|
||||
time.sleep(0.5)
|
||||
|
||||
|
||||
|
||||
@@ -401,6 +401,10 @@ class Session(LineReceiver):
|
||||
|
||||
self.log(logging.DEBUG, "%s %s" % (ip, server['publicip']))
|
||||
if server['publicip'] == ip and server['publicport'] == str(self.forward_client[1]):
|
||||
if self.forward_client[1] == 0 and 'localport' in server:
|
||||
# No public port returned from client, try contacting on the local port.
|
||||
self.forward_client[1] = int(server['localport'])
|
||||
|
||||
# Send command to server to get it to connect to natneg
|
||||
cookie = int(utils.generate_random_hex_str(8), 16) # Quick and lazy way to get a random 32bit integer. Replace with something else later
|
||||
|
||||
|
||||
Reference in New Issue
Block a user