diff options
author | David Goulet <dgoulet@torproject.org> | 2020-07-06 09:40:03 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2020-07-07 10:41:10 -0400 |
commit | f57ce632fe3d391e62d288c0b8acd0001bf670df (patch) | |
tree | 10b5ff619ffb6f17ac7c1d3a84c2a9da3511c215 /src/app | |
parent | 78bc52c47c8d7c3747ea3335b571fd98a15a47b1 (diff) | |
download | tor-f57ce632fe3d391e62d288c0b8acd0001bf670df.tar.gz tor-f57ce632fe3d391e62d288c0b8acd0001bf670df.zip |
addr: Rename and make resolved_addr_set_last() function public
Rename the static function update_resolved_cache() to resolved_addr_set_last()
and make it public.
We are about to use it in order to record any suggested address from a NETINFO
cell.
Related to #40022
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/app')
-rw-r--r-- | src/app/config/resolve_addr.c | 10 | ||||
-rw-r--r-- | src/app/config/resolve_addr.h | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/app/config/resolve_addr.c b/src/app/config/resolve_addr.c index 808c5ddf0b..2a11ba3c00 100644 --- a/src/app/config/resolve_addr.c +++ b/src/app/config/resolve_addr.c @@ -370,7 +370,7 @@ get_address_from_interface(const or_options_t *options, int warn_severity, return FN_RET_OK; } -/** @brief Update the last resolved address cache using the given address. +/** @brief Set the last resolved address cache using the given address. * * A log notice is emitted if the given address has changed from before. Not * emitted on first resolve. @@ -386,9 +386,9 @@ get_address_from_interface(const or_options_t *options, int warn_severity, * @param hostname_used Which hostname was used. If none were used, it is * NULL. (for logging and control port). */ -static void -update_resolved_cache(const tor_addr_t *addr, const char *method_used, - const char *hostname_used) +void +resolved_addr_set_last(const tor_addr_t *addr, const char *method_used, + const char *hostname_used) { /** Have we done a first resolve. This is used to control logging. */ static bool have_resolved_once[IDX_SIZE] = { false, false, false }; @@ -561,7 +561,7 @@ find_my_address(const or_options_t *options, int family, int warn_severity, /* * Step 2: Update last resolved address cache and inform the control port. */ - update_resolved_cache(&my_addr, method_used, hostname_used); + resolved_addr_set_last(&my_addr, method_used, hostname_used); if (method_out) { *method_out = method_used; diff --git a/src/app/config/resolve_addr.h b/src/app/config/resolve_addr.h index 54f55ba36c..055d59a8f1 100644 --- a/src/app/config/resolve_addr.h +++ b/src/app/config/resolve_addr.h @@ -17,6 +17,8 @@ bool find_my_address(const or_options_t *options, int family, void resolved_addr_get_last(int family, tor_addr_t *addr_out); void resolved_addr_reset_last(int family); +void resolved_addr_set_last(const tor_addr_t *addr, const char *method_used, + const char *hostname_used); MOCK_DECL(bool, is_local_to_resolve_addr, (const tor_addr_t *addr)); |