SMTDDR's gamespy_qr_server changes

This commit is contained in:
polaris
2014-10-11 16:22:42 -04:00
parent 51c665b775
commit e8fcc9fb82

View File

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