mirror of
https://github.com/barronwaffles/dwc_network_server_emulator.git
synced 2026-09-27 04:17:30 -05:00
SMTDDR's gamespy_qr_server changes
This commit is contained in:
@@ -56,6 +56,7 @@ class GameSpyQRServer(object):
|
||||
self.address = address
|
||||
self.console = 0
|
||||
self.playerid = 0
|
||||
self.ingamesn = None
|
||||
|
||||
self.gamename = ""
|
||||
self.keepalive = -1
|
||||
@@ -293,6 +294,18 @@ class GameSpyQRServer(object):
|
||||
#self.log(logging.DEBUG, address, session_id, "%s = %s" % (d[i], d[i+1]))
|
||||
k[d[i]] = d[i+1]
|
||||
|
||||
if self.sessions[session_id].ingamesn != None:
|
||||
if "gamename" in k and "dwc_pid" in k:
|
||||
try:
|
||||
profile = self.db.get_profile_from_profileid(k['dwc_pid'])
|
||||
naslogin = self.db.get_nas_login_from_userid(profile['userid'])
|
||||
self.sessions[session_id].ingamesn = str(naslogin['ingamesn']) # convert to string from unicode(which is just a base64 string anyway)
|
||||
except Exception,e:
|
||||
pass # If the game doesn't have, don't worry about it.
|
||||
|
||||
if self.sessions[session_id].ingamesn != None and "ingamesn" not in k:
|
||||
k['ingamesn'] = self.sessions[session_id].ingamesn
|
||||
|
||||
if "gamename" in k:
|
||||
if k['gamename'] in self.secret_key_list:
|
||||
self.sessions[session_id].secretkey = self.secret_key_list[k['gamename']]
|
||||
@@ -398,7 +411,7 @@ class GameSpyQRServer(object):
|
||||
|
||||
for session_id in self.sessions:
|
||||
delta = now - self.sessions[session_id].keepalive
|
||||
timeout = 60 * 5 # Remove clients that haven't responded in x seconds
|
||||
timeout = 61 # Remove clients that haven't responded in x seconds
|
||||
|
||||
if delta < 0 or delta >= timeout:
|
||||
pruned.append(session_id)
|
||||
|
||||
Reference in New Issue
Block a user