relay: Launch dummy circuit only when descriptor build fails
commitbc5f26ff7006f50acd23f9eb1a99449612b95198
authorDavid Goulet <dgoulet@torproject.org>
Fri, 18 Sep 2020 17:07:11 +0000 (18 13:07 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 17 Nov 2020 12:58:26 +0000 (17 07:58 -0500)
treef6eebcef8fb70c423a83e318371b071baa4396c1
parenta5538a36037641e49ca05aa3e90fec256794412b
relay: Launch dummy circuit only when descriptor build fails

First, this commit moves the launch_dummy_circuit_as_needed() function into
relay_find_addr.c and renames it to relay_addr_learn_from_dirauth(). This is
an attempt to centralize anything relate with address discovery in the right
module.

Second, when building a descriptor and we fail to discover our address,
immediately launch a dummy circuit to an authority in an attempt to learn our
descriptor.

It is still only done every 20 minutes even though the descriptor build is
done every minute. We ought to avoid load on the authority and if we can't
learn in the first place our address from them, chances are more things are
wrong.

Related to #40071

Signed-off-by: David Goulet <dgoulet@torproject.org>
src/feature/nodelist/routerlist.c
src/feature/relay/relay_find_addr.c
src/feature/relay/relay_find_addr.h
src/feature/relay/router.c