summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/piztor/mesg_sender.py1
-rw-r--r--server/piztor/server.py7
2 files changed, 7 insertions, 1 deletions
diff --git a/server/piztor/mesg_sender.py b/server/piztor/mesg_sender.py
index 64349a3..96a3a9d 100644
--- a/server/piztor/mesg_sender.py
+++ b/server/piztor/mesg_sender.py
@@ -24,4 +24,5 @@ send_text_mesg(token, username, mesg)
send_text_mesg(token, username, "a")
update_location(token, username, 1.2345, 2.468)
update_location(token, username, 1.2345, 2.468)
+send_text_mesg(token, username, "the last")
#logout(token, username)
diff --git a/server/piztor/server.py b/server/piztor/server.py
index 1814a39..ed4e0b9 100644
--- a/server/piztor/server.py
+++ b/server/piztor/server.py
@@ -52,6 +52,8 @@ _HEADER_SIZE = _SectionSize.LENGTH + \
_MAX_TEXT_MESG_SIZE = 1024
+_MAX_PENDING_PUSH = 100
+
class _OptCode:
user_auth = 0x00
location_update = 0x01
@@ -96,6 +98,9 @@ class PushTunnel(object):
def add(self, pdata):
logger.info("-- Push data enqued --")
self.pending.append(pdata)
+ if len(self.pending) > _MAX_PENDING_PUSH:
+ logger.info("-- Push queue is full, discarded an obsolete push --")
+ self.pending.popleft() # discard old push
def on_receive(self, data):
front = self.pending.popleft()
@@ -670,6 +675,6 @@ from twisted.internet import reactor
f = PTPFactory()
f.protocol = PTP
-reactor.listenTCP(2222, f)
+reactor.listenTCP(2223, f)
logger.warning("The server is lanuched")
reactor.run()