[tor-commits] [tor/master] addr: Rename and make resolved_addr_set_last() function public

nickm at torproject.org nickm at torproject.org
Thu Jul 9 18:31:12 UTC 2020


commit f57ce632fe3d391e62d288c0b8acd0001bf670df
Author: David Goulet <dgoulet at torproject.org>
Date:   Mon Jul 6 09:40:03 2020 -0400

    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 at torproject.org>
---
 src/app/config/resolve_addr.c | 10 +++++-----
 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 808c5ddf0..2a11ba3c0 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 54f55ba36..055d59a8f 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));
 





More information about the tor-commits mailing list