Commit 2a940428 authored by anonym's avatar anonym
Browse files

onion-grater: rate limit how often we try to connect to tor.

parent 0105c5bf
......@@ -567,8 +567,15 @@ class FilteredControlPortProxyHandler(socketserver.StreamRequestHandler):
def connect_to_real_control_port(self):
controller = None
tries = 0
# If tor isn't running this would just loop endlessly as fast
# as possible, so let's rate limit it so it at least cannot
# become a performance issue.
while not controller:
if tries >= 3:
controller = stem.connection.connect(control_socket=global_args.control_socket_path)
tries += 1
stem.connection.authenticate_cookie(controller, cookie_path=global_args.control_cookie_path)
return controller
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