diff options
-rw-r--r-- | server/piztor/mesg_sender.py | 2 | ||||
-rw-r--r-- | server/piztor/server.py | 10 |
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)) |