ssddesc = '[%s] %s' % (id(req), self._desc)
self._ssd = SlipStreamDecoder(ssddesc, cl.queue_inbound)
self._log(DBG.HTTP_CTRL, '__init__')
+ self._success_reported = False
def dataReceived(self, data):
self._log(DBG.HTTP, 'dataReceived', d=data)
self.cl.req_fin(self._req)
except Exception as e:
self._handleexception()
+ if not self._success_reported:
+ log.info(cl.desc + 'running OK', dflag=False)
+ self._success_reported = True
def _handleexception(self):
self._latefailure(traceback.format_exc())
cl.c = c
cl.outstanding = { }
cl.desc = '[%s %s] ' % (ss,cs)
+ log.info(cl.desc + 'setting up', dflag=False)
def log(cl, dflag, msg, **kwargs):
log_debug(dflag, cl.desc + msg, **kwargs)
def log_outstanding(cl):
- cl.log(DBG.CTRL_DUMP, 'OS %s' % outstanding)
+ cl.log(DBG.CTRL_DUMP, 'OS %s' % cl.outstanding)
def start(cl):
cl.queue = PacketQueue('up', cl.c.max_queue_time)
if isinstance(err, twisted.python.failure.Failure):
err = err.getTraceback()
print('[%#x] %s' % (id(req), err), file=sys.stderr)
- if not isinstance(outstanding[req], int):
- raise RuntimeError('[%#x] previously %s' % (id(req), outstanding[req]))
+ if not isinstance(cl.outstanding[req], int):
+ raise RuntimeError('[%#x] previously %s' %
+ (id(req), cl.outstanding[req]))
cl.outstanding[req] = err
cl.log_outstanding()
reactor.callLater(cl.c.http_retry, partial(cl.req_fin, req))
def req_fin(cl, req):
del cl.outstanding[req]
- cl.log(DBG.HTTP_CTRL, 'req_fin OS=%d' % len(outstanding), idof=req)
+ cl.log(DBG.HTTP_CTRL, 'req_fin OS=%d' % len(cl.outstanding), idof=req)
cl.check_outbound()
def check_outbound(cl):
if len(cl.outstanding) >= cl.c.max_outstanding:
break
- if (not queue.nonempty() and
- len(cl.outstanding) >= cl.c.target_outstanding):
+ if (not cl.queue.nonempty() and
+ len(cl.outstanding) >= cl.c.target_requests_outstanding):
break
d = b''
def moredata(s): nonlocal d; d += s
- queue.process((lambda: len(d)),
+ cl.queue.process((lambda: len(d)),
moredata,
cl.c.max_batch_up)
b'Content-Disposition: form-data; name="m"' + crlf + crlf +
str(cl.c.client) .encode('ascii') + crlf +
cl.c.password + crlf +
- str(cl.c.target_outstanding).encode('ascii') + crlf +
+ str(cl.c.target_requests_outstanding)
+ .encode('ascii') + crlf +
str(cl.c.http_timeout) .encode('ascii') + crlf +
((
b'--b' + crlf +
bytesreader = io.BytesIO(mime)
producer = twisted.web.client.FileBodyProducer(bytesreader)
- req = agent.request(b'POST',
+ req = cl.agent.request(b'POST',
cl.c.url,
twisted.web.client.Headers(hh),
producer)