chiark
/
gitweb
/
~ian
/
hippotat.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ResponseConsumer: break out connectionLostOK into superclass
[hippotat.git]
/
hippotat
diff --git
a/hippotat
b/hippotat
index abe1caeb88b891f92f4c925e51d0c4c41030b95a..200cf3a2a4b333ba797c7b4d36719289687209ab 100755
(executable)
--- a/
hippotat
+++ b/
hippotat
@@
-42,6
+42,9
@@
class GeneralResponseConsumer(twisted.internet.protocol.Protocol):
def connectionMade(self):
self._log(DBG.HTTP_CTRL, 'connectionMade')
def connectionMade(self):
self._log(DBG.HTTP_CTRL, 'connectionMade')
+ def connectionLostOK(self, reason):
+ return reason.check(twisted.web.client.ResponseDone)
+
class ResponseConsumer(GeneralResponseConsumer):
def __init__(self, cl, req, resp):
super().__init__(cl, req, resp, 'RC')
class ResponseConsumer(GeneralResponseConsumer):
def __init__(self, cl, req, resp):
super().__init__(cl, req, resp, 'RC')
@@
-59,7
+62,7
@@
class ResponseConsumer(GeneralResponseConsumer):
def connectionLost(self, reason):
reason_msg = 'connectionLost ' + str(reason)
self._log(DBG.HTTP_CTRL, reason_msg)
def connectionLost(self, reason):
reason_msg = 'connectionLost ' + str(reason)
self._log(DBG.HTTP_CTRL, reason_msg)
- if not
reason.check(twisted.web.client.ResponseDone
):
+ if not
self.connectionLostOK(reason
):
self._latefailure(reason_msg)
return
try:
self._latefailure(reason_msg)
return
try:
@@
-96,7
+99,7
@@
class ErrorResponseConsumer(GeneralResponseConsumer):
mbody = self._m.decode('utf-8')
except Exception:
mbody = repr(self._m)
mbody = self._m.decode('utf-8')
except Exception:
mbody = repr(self._m)
- if not
reason.check(twisted.web.client.ResponseDone
):
+ if not
self.connectionLostOK(reason
):
mbody += ' || ' + str(reason)
self._cl.req_err(self._req,
"FAILED %d %s | %s"
mbody += ' || ' + str(reason)
self._cl.req_err(self._req,
"FAILED %d %s | %s"