dirserv: Remove dead code
While working on #25610 (moved), I've noticed dead code that uses dirserv_get_consensus()
.
In networkstatus.c
, function networkstatus_set_current_consensus()
:
We parse the flavor and if it is unknown, we bail early with:
if (flav < 0) {
/* XXXX we don't handle unrecognized flavors yet. */
log_warn(LD_BUG, "Unrecognized consensus flavor %s", flavor);
return -2;
}
But later in the function we have this if/else on the flavor name with a else {}
statement that uses dirserv_get_consensus()
. But we can't get into that else case since the first conditions are the only two flavors we can handle.
In between the first checks above and this if/else ^, the flavor can change as in we take the one from the given consensus but again, there is a check on if we can handle that flavor:
if (flav != usable_consensus_flavor() &&
!we_want_to_fetch_flavor(options, flav)) {
Bottom line, I think the else {}
code is dead code. This simplifies the callgraph into the dirauth subsystem.