Skip to content

Parallelize connections in launch_hs_circuits_as_needed.

wesleyac requested to merge wesleyac/arti:hscircpool-parallel into main

When we're launching circuits for onion service use, launch multiple in parallel.

This removes the CircsToLaunch and ForLaunch abstractions: CircsToLaunch existed largely to ensure that short stubs were launched before extended ones, which is no longer needed when we do that in parallel. ForLaunch was tied in with CircsToLaunch, and no longer provides any benefit now that CircsToLaunch is no longer needed.

It remains a little awkward that the bookkeeping is split between Pool and HsCircPool, but I think the ideal way to resolve that is to merge Pool and HsCircPool together. That's a task for a future MR, though.

The actual launching logic is a little odd, since we can block on a single circuit taking a long time before we run the background task again, but it's probably the best we can do without refactoring this to remove the "background task" abstraction.

We don't have tests for this code, so it was tested by running a arti client in proxy mode at the trace log level, and connecting to a handful of onion services via curl. This was successful, and the logs showed that the expected codepath was being taken.

This largely fixes #1149 - I expect that the remaining parts of that will require more refactoring, which I will make separate issues for.

Edited by wesleyac

Merge request reports

Loading