mirror of
https://github.com/barronwaffles/dwc_network_server_emulator.git
synced 2026-08-27 13:24:03 -05:00
Fixed invalid filter error
If the first server in the server list does not have all of the requested fields, it would assume that all of the servers lacked the requested fields, so it would bail. This will let it keep checking against ever server and skip the ones without the requested fields.
This commit is contained in:
@@ -83,7 +83,12 @@ def rc4_encrypt(_key, _data):
|
||||
# This seems to be what Luigi Auriemma calls "Gsmsalg".
|
||||
def prepare_rc4_base64(_key, _data):
|
||||
data = rc4_encrypt(_key, _data)
|
||||
|
||||
if data == None:
|
||||
data = bytearray()
|
||||
|
||||
data.append(0)
|
||||
|
||||
return base64.b64encode(buffer(data))
|
||||
|
||||
# get the login data from nas.nintendowifi.net/ac from an authtoken
|
||||
@@ -101,12 +106,16 @@ def login_profile_via_parsed_authtoken(authtoken_parsed, db):
|
||||
birth = authtoken_parsed.get('birth', '') # NDS: User's birthday
|
||||
|
||||
# The Wii does not use passwd, so take another uniquely generated string as the password.
|
||||
if "passwd" in authtoken_parsed:
|
||||
password = authtoken_parsed['passwd']
|
||||
else:
|
||||
password = authtoken_parsed['gsbrcd']
|
||||
# if "passwd" in authtoken_parsed:
|
||||
# password = authtoken_parsed['passwd']
|
||||
# else:
|
||||
# password = authtoken_parsed['gsbrcd']
|
||||
# console = 1
|
||||
|
||||
if not "passwd" in authtoken_parsed:
|
||||
console = 1
|
||||
|
||||
password = authtoken_parsed['gsbrcd']
|
||||
gsbrcd = authtoken_parsed['gsbrcd']
|
||||
gameid = gsbrcd[:4]
|
||||
uniquenick = utils.base32_encode(int(userid)) + gsbrcd
|
||||
|
||||
@@ -161,6 +161,7 @@ class GameSpyBackendServer(object):
|
||||
i += 1
|
||||
while i < len(filters) and filters[i].isdigit():
|
||||
i += 1
|
||||
|
||||
elif filters[i].isalnum() or filters[i] in special_chars:
|
||||
# Whole numbers or words
|
||||
if filters[i].isdigit():
|
||||
@@ -303,7 +304,8 @@ class GameSpyBackendServer(object):
|
||||
if valid_filter == False:
|
||||
# Return only anything matched up until this point.
|
||||
logger.log(logging.WARNING, "Invalid filter(s): %s" % (filters))
|
||||
stop_search = True
|
||||
#stop_search = True
|
||||
continue
|
||||
else:
|
||||
# Use Python to evaluate the query. This method may take a little time but it shouldn't be all that
|
||||
# big of a difference, I think. It takes about 0.0004 seconds per server to determine whether or not it's a
|
||||
@@ -320,7 +322,7 @@ class GameSpyBackendServer(object):
|
||||
if stop_search == True:
|
||||
break
|
||||
|
||||
if result == True:
|
||||
if valid_filter == True and result == True:
|
||||
matched_servers.append(server)
|
||||
|
||||
if max_count != 0 and len(matched_servers) >= max_count:
|
||||
|
||||
@@ -383,7 +383,7 @@ class GameSpyQRServer(object):
|
||||
for session_id in self.sessions:
|
||||
now = int(time.time())
|
||||
delta = now - self.sessions[session_id].keepalive
|
||||
timeout = 60 # Remove clients that haven't responded in 60 seconds
|
||||
timeout = 60 * 5 # 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