chiark
/
gitweb
/
~ian
/
hippotat.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
wip, towards target
[hippotat.git]
/
client
diff --git
a/client
b/client
index 7b2bf78f678f607e514b0457bbb8c697ba6ef3a1..e4e5eae7a01df3e180be74d170b6404f37a78f6f 100755
(executable)
--- a/
client
+++ b/
client
@@
-60,20
+60,32
@@
def outbound(packet, saddr, daddr):
class ResponseConsumer(twisted.internet.protocol.Protocol):
def __init__(self, req):
class ResponseConsumer(twisted.internet.protocol.Protocol):
def __init__(self, req):
- print('RC INIT', file=sys.stderr)
self._req = req
self._ssd = SlipStreamDecoder(queue_inbound)
self._req = req
self._ssd = SlipStreamDecoder(queue_inbound)
+ self._log(DBG.HTTP_CTRL, '__init__')
+
+ def _log(self, dflag, msg, **kwargs):
+ log_debug(dflag, 'RC ' + msg, idof=self._req, **kwargs)
def dataReceived(self, data):
try: self._ssd.inputdata(mime_translate(data))
except Exception as e: asyncfailure(e)
def dataReceived(self, data):
try: self._ssd.inputdata(mime_translate(data))
except Exception as e: asyncfailure(e)
- def connectionMade(self): pass
+
+ def connectionMade(self):
+ self._log(DBG.HTTP_CTRL, 'connectionMade')
+
def connectionLost(self, reason):
def connectionLost(self, reason):
+ self._log(DBG.HTTP_CTRL, 'connectionLost')
if isinstance(reason, twisted.internet.error.ConnectionDone):
try: self._ssd.flush()
except Exception as e: asyncfailure(e)
else:
if isinstance(reason, twisted.internet.error.ConnectionDone):
try: self._ssd.flush()
except Exception as e: asyncfailure(e)
else:
- asyncfailure(reason)
+ self._asyncfailure(reason)
+
+ def _asyncfailure(self, reason):
+ global outstanding
+ outstanding += 1
+ req_err(reason)
def req_ok(req, resp):
rc = ResponseConsumer(req)
def req_ok(req, resp):
rc = ResponseConsumer(req)