Stop being willing to build 2-hop circuits when there aren't 3 relays
new_route_len() ends with
if (num_acceptable_routers < 2) {
log_info(LD_CIRC,
"Not enough acceptable routers (%d). Discarding this circuit.",
num_acceptable_routers);
return -1;
}
if (num_acceptable_routers < routelen) {
log_info(LD_CIRC,"Not enough routers: cutting routelen from %d to %d.",
routelen, num_acceptable_routers);
routelen = num_acceptable_routers;
}
We should replace this with the simpler
if (num_acceptable_routers < 3) {
log_info(LD_CIRC,
"Not enough acceptable routers (%d). Discarding this circuit.",
num_acceptable_routers);
return -1;
}
to simplify things.
Note that the "oh hey let's just use two hops" case doesn't trigger in a real Tor network, because we won't be willing to make circuits if we don't have at least x% of the descriptors, so this code only comes into play when the consensus says there are 5 or something relays total.