GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Commit cb97fe8c authored by juga  's avatar juga

chg: circuitbuilder: Remove not used attributes

and make argument optional.
parent b3ab8ebf
Pipeline #1923 passed with stage
in 80 minutes and 26 seconds
from stem import CircuitExtensionFailed, InvalidRequest, ProtocolError, Timeout
from stem import InvalidArguments, ControllerError, SocketClosed
import random
from .relaylist import Relay
import logging
log = logging.getLogger(__name__)
......@@ -25,24 +23,14 @@ class CircuitBuilder:
them, but CircuitBuilder will keep track of existing circuits and close
them when it is deleted.
'''
def __init__(self, args, conf, controller, relay_list,
# XXX: In new major version, remove args and conf, they are not used.
def __init__(self, args, conf, controller, relay_list=None,
close_circuits_on_exit=True):
self.controller = controller
self.rng = random.SystemRandom()
self.relay_list = relay_list
self.built_circuits = set()
self.close_circuits_on_exit = close_circuits_on_exit
self.circuit_timeout = conf.getint('general', 'circuit_timeout')
@property
def relays(self):
return self.relay_list.relays
def build_circuit(self, *a, **kw):
''' Implementations of this method should build the circuit and return
its (str) ID. If it cannot be built, it should return None. '''
raise NotImplementedError()
def close_circuit(self, circ_id):
try:
self.controller.close_circuit(circ_id)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment