Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
juga
sbws
Commits
cb97fe8c
Commit
cb97fe8c
authored
Dec 08, 2020
by
juga
Browse files
chg: circuitbuilder: Remove not used attributes
and make argument optional.
parent
b3ab8ebf
Pipeline
#1923
passed with stage
in 80 minutes and 26 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
sbws/lib/circuitbuilder.py
View file @
cb97fe8c
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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment