Skip to content

Commit

Permalink
need to get circuit for timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
david415 authored and meejah committed Apr 29, 2018
1 parent e66eb9c commit 2bc5beb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions txtorcon/circuit.py
Expand Up @@ -538,6 +538,10 @@ def build_timeout_circuit(tor_state, reactor, path, timeout, using_guards=False)
timed_circuit = []
d = tor_state.build_circuit(routers=path, using_guards=using_guards)

def get_circuit(c):
timed_circuit.append(c)
return c

def trap_cancel(f):
f.trap(defer.CancelledError)
if timed_circuit:
Expand All @@ -548,6 +552,7 @@ def trap_cancel(f):
return d2

d.addCallback(lambda circ: circ.when_built())
d.addCallback(get_circuit)
d.addErrback(trap_cancel)

reactor.callLater(timeout, d.cancel)
Expand Down

0 comments on commit 2bc5beb

Please sign in to comment.