~mdw
/
hippotat
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
wip, before optional args log_xxx
[hippotat]
/
hippotat
/
__init__.py
diff --git
a/hippotat/__init__.py
b/hippotat/__init__.py
index
9bfe280
..
abc2a9f
100644
(file)
--- a/
hippotat/__init__.py
+++ b/
hippotat/__init__.py
@@
-22,8
+22,19
@@
import time
import re as regexp
import re as regexp
+from twisted.python.constants import NamedConstant
+
import hippotat.slip as slip
import hippotat.slip as slip
+class DBG(twisted.python.constants.Names):
+ ROUTE = NamedConstant()
+ FLOW = NamedConstant()
+ HTTP = NamedConstant()
+ HTTP_CTRL = NamedConstant()
+ INIT = NamedConstant()
+ QUEUE = NamedConstant()
+ QUEUE_CTRL = NamedConstant()
+
defcfg = '''
[DEFAULT]
#[<client>] overrides
defcfg = '''
[DEFAULT]
#[<client>] overrides
@@
-179,14
+190,20
@@
def queue_inbound(packet):
#---------- packet queue ----------
class PacketQueue():
#---------- packet queue ----------
class PacketQueue():
- def __init__(self, max_queue_time):
+ def __init__(self, desc, max_queue_time):
+ self._desc = desc
self._max_queue_time = max_queue_time
self._pq = collections.deque() # packets
self._max_queue_time = max_queue_time
self._pq = collections.deque() # packets
+ def _log_debug(self, fn, pri, msg)
+ log_debug(pri,
+
def append(self, packet):
def append(self, packet):
+ log_data(DBG.QUEUE, packet, 'pq %s: append' % self._desc)
self._pq.append((time.monotonic(), packet))
def nonempty(self):
self._pq.append((time.monotonic(), packet))
def nonempty(self):
+ log_debug(DBG.QUEUE, 'pq %s: nonempty ?' % self._desc)
while True:
try: (queuetime, packet) = self._pq[0]
except IndexError: return False
while True:
try: (queuetime, packet) = self._pq[0]
except IndexError: return False