From 8b62cd2cd460d666d5981cc5c34861c59b453622 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 1 Apr 2017 20:39:35 +0100 Subject: [PATCH] wip, towards target --- client | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/client b/client index 829087e..7b2bf78 100755 --- a/client +++ b/client @@ -59,7 +59,9 @@ def outbound(packet, saddr, daddr): check_outbound() class ResponseConsumer(twisted.internet.protocol.Protocol): - def __init__(self): + def __init__(self, req): + print('RC INIT', file=sys.stderr) + self._req = req self._ssd = SlipStreamDecoder(queue_inbound) def dataReceived(self, data): @@ -73,8 +75,9 @@ class ResponseConsumer(twisted.internet.protocol.Protocol): else: asyncfailure(reason) -def req_ok(resp): - resp.deliverBody(ResponseConsumer()) +def req_ok(req, resp): + rc = ResponseConsumer(req) + resp.deliverBody(rc) req_fin() def req_err(err): @@ -141,7 +144,8 @@ def check_outbound(): twisted.web.client.Headers(hh), producer) req.addTimeout(c.http_timeout, reactor) - req.addCallbacks(req_ok, req_err) + req.addCallback((lambda resp: req_ok(req, resp))) + req.addErrback(req_err) outstanding += 1 common_startup() -- 2.30.2