Skip to content

Commit

Permalink
Merge c171f53 into 8919847
Browse files Browse the repository at this point in the history
  • Loading branch information
arlolra committed Aug 15, 2014
2 parents 8919847 + c171f53 commit e2b78fe
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions txtorcon/torstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,16 +507,18 @@ def _find_circuit_after_extend(self, x):
circ.update([str(circ_id), 'EXTENDED'])
return circ

def build_circuit(self, routers=None):
def build_circuit(self, routers=None, using_guards=True):
"""
Builds a circuit consisting of exactly the routers specified,
in order. This issues an EXTENDCIRCUIT call to Tor with all
the routers specified.
:param routers: a list of Router instances which is the path
desired. A warming is issued if the first one isn't in
self.entry_guards To allow Tor to choose the routers
itself, pass None (the default) for routers.
desired. To allow Tor to choose the routers itself, pass
None (the default) for routers.
:param using_guards: A warming is issued if the first router
isn't in self.entry_guards.
:return:
A Deferred that will callback with a Circuit instance
Expand All @@ -528,7 +530,7 @@ def build_circuit(self, routers=None):
cmd = "EXTENDCIRCUIT 0"

else:
if routers[0] not in self.entry_guards.values():
if using_guards and routers[0] not in self.entry_guards.values():
warnings.warn("Building a circuit not starting with a guard: %s" % (str(routers),), RuntimeWarning)
cmd = "EXTENDCIRCUIT 0 "
first = True
Expand Down

0 comments on commit e2b78fe

Please sign in to comment.