Commit abdcfd80 authored by Matt Traudt's avatar Matt Traudt
Browse files

Allow sbws to use an already-existing tor process, with warning

parent 1b0a2f89
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -277,7 +277,22 @@ def result_putter_error(target):


def run_speedtest(args, conf):
    controller, _ = stem_utils.init_controller(
        path=conf['tor']['control_socket'])
    if not controller:
        controller = stem_utils.launch_tor(conf)
    else:
        log.warning(
            'Is sbws already running? '
            'We found an existing Tor process at %s. We are not going to '
            'launch Tor, nor are we going to try to configure it to behave '
            'like we expect. This might work okay, but it also might not. '
            'If you experience problems, you should try letting sbws launch '
            'Tor for itself. The ability to use an already running Tor only '
            'exists for sbws developers. It is expected to be broken and may '
            'even lead to messed up results.', conf['tor']['control_socket'])
        time.sleep(15)
    assert stem_utils.is_controller_okay(controller)
    cb = CB(args, conf, controller)
    rl = RelayList(args, conf, controller)
    rd = ResultDump(args, conf, end_event)
+3 −0
Original line number Diff line number Diff line
@@ -59,6 +59,9 @@ def remove_event_listener(controller, func):


def init_controller(port=None, path=None, set_custom_stream_settings=True):
    # NOTE: we do not currently support a control port even though the rest of
    # this function will pretend like port could be set.
    assert port is None
    # make sure only one is set
    assert port is not None or path is not None
    assert not (port is not None and path is not None)