chg: When an exit fail to exit, check CC
before selecting other exits as helpers. In #40136 (closed) we forgot to consider the corner case in #40041 (closed), discovered thanks to analysis#36 (closed). This was causing that sometimes a CC circuit was built when bwscanner_cc wasn't equal or greater than 1 or the other way around.
We didn't realize about this cause this part of the code is very confusing. To don't make it even more confusing, i've changed the internal API:
-
select_helper_candidates
: split funtion into one to select the helper candidates, knowing whether to use the relay as exit or not and other functionuse_relay_as_entry
to decide whether to use the relay as entry or not checking CC params. Also pass a new argrelay_as_entry
. -
create_path_relay
: rewmove not usedcb
arg, addcandidates
arg to stop having to select them again later on. Move the nocandidates
condition here instead of checking it inpick_ideal_second_hop
. -
_pick_ideal_second_hope: remove unneded
destand
cont arguments, renameis_exit
tohelper_is_exit
. Use the candidates instead of selecting them again. -
measure_relay
: in the case an exit fails to exit, select the candidates knowing that they have to be exits and checking CC. -
only_relays_with_bandwidth
: remove unneded argcontroller
so that there is no need to pass it through several functions.
Closes #40138 (closed)