From a6b57b7cd05f150f3f0a84d756234a09a7611a34 Mon Sep 17 00:00:00 2001 From: Teddy Date: Fri, 30 Aug 2013 17:28:54 +0800 Subject: fixed issue #32 --- server/piztor/mesg_sender.py | 2 ++ server/piztor/server.py | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'server') 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)) -- cgit v1.2.3-70-g09d2