diff options
author | Teddy <[email protected]> | 2013-09-01 11:37:55 +0800 |
---|---|---|
committer | Teddy <[email protected]> | 2013-09-01 11:37:55 +0800 |
commit | 5ebd9d005355d97eaa89c7b86afd80c32cdafd5c (patch) | |
tree | 2c0c23da307af3eb145e2a11263bb1680e637a1e /server | |
parent | 096ca60866991ccfd218c7af9b79757cd4fdd4c5 (diff) |
fixed a bug in limiting queue size
Diffstat (limited to 'server')
-rw-r--r-- | server/piztor/mesg_sender.py | 9 | ||||
-rw-r--r-- | server/piztor/ptp_send.py | 4 | ||||
-rw-r--r-- | server/piztor/server.py | 4 |
3 files changed, 9 insertions, 8 deletions
diff --git a/server/piztor/mesg_sender.py b/server/piztor/mesg_sender.py index c3fc385..bc11a70 100644 --- a/server/piztor/mesg_sender.py +++ b/server/piztor/mesg_sender.py @@ -21,10 +21,11 @@ if len(argv) == 4: token = user_auth(username, password) #update_location(token, username, 31.028616, 121.434661) -#update_location(token, username, 31.028616, 121.434661) -#set_marker(token, username, 10.028716, 121.545661, 0x7fffffff) -#send_text_mesg(token, username, mesg) +for i in xrange(100): + update_location(token, username, 31.028616, 121.434661) + set_marker(token, username, 10.028716, 121.545661, 0x7fffffff) + send_text_mesg(token, username, mesg) #send_text_mesg(token, username, "a") #send_text_mesg(token, username, "the last") -update_sub(token, username, [(0, 0)]) +#update_sub(token, username, [(0, 0)]) logout(token, username) diff --git a/server/piztor/ptp_send.py b/server/piztor/ptp_send.py index 42a566d..6c3b476 100644 --- a/server/piztor/ptp_send.py +++ b/server/piztor/ptp_send.py @@ -24,8 +24,8 @@ class _SectionSize: LOCATION_ENTRY = USER_ID + LATITUDE + LONGITUDE PADDING = 1 -#host = "202.120.7.4" -host = "localhost" +host = "202.120.7.4" +#host = "localhost" port = 2223 def pack_data(optcode, data): diff --git a/server/piztor/server.py b/server/piztor/server.py index 512eb68..a4f5d69 100644 --- a/server/piztor/server.py +++ b/server/piztor/server.py @@ -52,7 +52,7 @@ _HEADER_SIZE = _SectionSize.LENGTH + \ _MAX_TEXT_MESG_SIZE = 1024 _MAX_SUB_LIST_SIZE = 10 -_MAX_PENDING_PUSH = 100 +_MAX_PENDING_PUSH = 10 class _OptCode: user_auth = 0x00 @@ -107,7 +107,7 @@ class PushTunnel(object): def add(self, pdata): logger.info("-- Push data enqued --") self.pending.append(pdata) - if len(self.pending) > _MAX_PENDING_PUSH: + if not self.blocked and len(self.pending) > _MAX_PENDING_PUSH: logger.info("-- Push queue is full, discarded an obsolete push --") self.pending.popleft() # discard old push |