queue.append(packet)
check_outbound()
+class ResponseConsumer(twisted.internet.protocol.Protocol):
+ def __init__(self):
+ self._ssd = SlipStreamDecoder(queue_inbound)
+ def dataReceived(self, data):
+ self._ssd.inputdata(mime_translate(data))
+ def connectionMade(self): pass
+ def connectionLost(self, reason):
+ if isinstance(reason, twisted.internet.error.ConnectionDone):
+ self._ssd.flush()
+ else:
+ print(reason, file=sys.stderr)
+
def req_ok(resp):
-
+ resp.deliverBody(ResponseConsumer())
def req_err(err):
print(err, >>sys.stderr)