From 52d99cd34b1774d06d049ee75a9577d539851d5a Mon Sep 17 00:00:00 2001 From: Teddy Date: Wed, 28 Aug 2013 09:42:56 +0800 Subject: ptp v0.5 and std-compliant server --- server/piztor/prober.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'server/piztor/prober.py') diff --git a/server/piztor/prober.py b/server/piztor/prober.py index ec6afa8..9cfde24 100644 --- a/server/piztor/prober.py +++ b/server/piztor/prober.py @@ -25,8 +25,8 @@ class _SectionSize: LOCATION_ENTRY = USER_ID + LATITUDE + LONGITUDE PADDING = 1 -host = "localhost" -port = 2222 +host = "69.85.86.42" #"localhost" +port = 2223 def gen_auth(username, password): length = _SectionSize.LENGTH + \ @@ -177,6 +177,9 @@ def request_user_info(token, username, uid): logger.error("Request user info: incorrect packet length") idx = 6 + comp_id = None + sec_id = None + sex = None while idx < pl: info_key, = unpack("!B", resp[idx:idx + 1]) idx += 1 @@ -210,9 +213,10 @@ for i in xrange(10): update_location(token, username, random(), random()) comp_id, sec_id, sex = request_user_info(token, username, uid) - request_location(token, username, comp_id * 256 + sec_id) - request_location(token, username, comp_id * 256 + 0xff) + if comp_id: + request_location(token, username, comp_id * 256 + sec_id) + request_location(token, username, comp_id * 256 + 0xff) - logout(token, username) + logout(token, username) sleep(10) -- cgit v1.2.3