summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeddy <[email protected]>2013-08-30 17:28:54 +0800
committerTeddy <[email protected]>2013-08-30 17:28:54 +0800
commita6b57b7cd05f150f3f0a84d756234a09a7611a34 (patch)
tree905f406908bbaf30f333d587230ac155673baefb
parentaf84e3060d5f4f3e97be483e6616c6f3cd872309 (diff)
fixed issue #32
-rw-r--r--server/piztor/mesg_sender.py2
-rw-r--r--server/piztor/server.py10
2 files changed, 7 insertions, 5 deletions
diff --git a/server/piztor/mesg_sender.py b/server/piztor/mesg_sender.py
index 2242fc4..ef4c1f7 100644
--- a/server/piztor/mesg_sender.py
+++ b/server/piztor/mesg_sender.py
@@ -23,4 +23,6 @@ token = user_auth(username, password)
send_text_mesg(token, username, mesg)
send_text_mesg(token, username, "a")
send_text_mesg(token, username, "the last")
+update_location(token, username, random(), random())
+update_location(token, username, random(), random())
logout(token, username)
diff --git a/server/piztor/server.py b/server/piztor/server.py
index b944f20..aa5d72c 100644
--- a/server/piztor/server.py
+++ b/server/piztor/server.py
@@ -121,7 +121,11 @@ class PushTunnel(object):
logger.info("-- Wrote push: %s --", get_hex(front.data))
self.blocked = True
+ def clear(self):
+ self.pending.clear()
+
def connect(self, conn):
+ self.clear()
conn.tunnel = self
if self.conn: # only one long-connection per user
self.conn.transport.loseConnection()
@@ -523,11 +527,7 @@ class OpenPushTunnelHandler(RequestHandler):
return self.pack(struct.pack("!B", _StatusCode.failure))
tunnel = RequestHandler.push_tunnels[uauth.uid]
- pt = RequestHandler.push_tunnels
- uid = uauth.uid
- if pt.has_key(uid):
- tunnel = pt[uid]
- tunnel.connect(conn)
+ tunnel.connect(conn)
logger.info("Push tunnel opened successfully!")
return self.pack(struct.pack("!B", _StatusCode.sucess))