cl.log(DBG.CTRL_DUMP, 'OS %s' % outstanding)
def start(cl):
- cl.queue = PacketQueue('up', c.max_queue_time)
+ cl.queue = PacketQueue('up', cl.c.max_queue_time)
cl.agent = twisted.web.client.Agent(
- reactor, connectTimeout = c.http_timeout)
+ reactor, connectTimeout = cl.c.http_timeout)
def outbound(cl, packet, saddr, daddr):
#print('OUT ', saddr, daddr, repr(packet))
cl.log(DBG.HTTP_CTRL,
'req_ok %d %s %s' % (resp.code, repr(resp.phrase), str(resp)),
idof=req)
- if resp.code == 200:
- rc = ResponseConsumer(cl, req)
- else:
- rc = ErrorResponseConsumer(cl, req, resp)
+ if resp.code == 200:
+ rc = ResponseConsumer(cl, req)
+ else:
+ rc = ErrorResponseConsumer(cl, req, resp)
- resp.deliverBody(rc)
- # now rc is responsible for calling req_fin
+ resp.deliverBody(rc)
+ # now rc is responsible for calling req_fin
def req_err(cl, req, err):
# called when the Deferred fails, or (if it completes),
raise RuntimeError('[%#x] previously %s' % (id(req), outstanding[req]))
cl.outstanding[req] = err
cl.log_outstanding()
- reactor.callLater(c.http_retry, partial(cl.req_fin, req))
+ reactor.callLater(cl.c.http_retry, partial(cl.req_fin, req))
except Exception as e:
crash(traceback.format_exc() + '\n----- handling -----\n' + err)
for (ci,cs) in putative_clients.items():
c = ConfigResults()
- sections = process_cfg_client_common(c,ss,cs,ci):
+ sections = cfg_process_client_common(c,ss,cs,ci)
if not sections: continue
def srch(getter,key): return cfg_search(getter,key,sections)
c.http_retry = srch(cfg.getint, 'http_retry')
c.vroutes = srch(cfg.get, 'vroutes')
- process_cfg_common(c,ss)
try: c.url = srch(cfg.get,'url')
except NoOptionError:
- process_cfg_saddrs()
+ cfg_process_saddrs(c, ss)
c.url = c.saddrs[0].url()
- process_cfg_ipif(cc,
+ c.client = ci
+
+ cfg_process_vaddr(c,ss)
+
+ cfg_process_ipif(c,
sections,
(('local','client'),
('peer', 'vaddr'),