[tor-commits] [tor/master] Make connection_or_get_by_ext_or_id() testing-only

nickm at torproject.org nickm at torproject.org
Wed Feb 19 18:55:40 UTC 2020


commit df6191f620f92ce2196955a240c45da63c074fee
Author: Nick Mathewson <nickm at torproject.org>
Date:   Wed Feb 19 12:04:31 2020 -0500

    Make connection_or_get_by_ext_or_id() testing-only
    
    Apparently it is only used by the unit tests: tor doesn't want it at
    all.
    
    I've opened a new ticket (33383) to we if we should remove this
    whole feature.
---
 src/feature/relay/ext_orport.c | 2 ++
 src/feature/relay/ext_orport.h | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/feature/relay/ext_orport.c b/src/feature/relay/ext_orport.c
index eada68347..533400bff 100644
--- a/src/feature/relay/ext_orport.c
+++ b/src/feature/relay/ext_orport.c
@@ -675,6 +675,7 @@ connection_or_remove_from_ext_or_id_map(or_connection_t *conn)
   memset(conn->ext_or_conn_id, 0, EXT_OR_CONN_ID_LEN);
 }
 
+#ifdef TOR_UNIT_TESTS
 /** Return the connection whose ext_or_id is <b>id</b>. Return NULL if no such
  * connection is found. */
 or_connection_t *
@@ -684,6 +685,7 @@ connection_or_get_by_ext_or_id(const char *id)
     return NULL;
   return digestmap_get(orconn_ext_or_id_map, id);
 }
+#endif
 
 /** Deallocate the global Extended ORPort identifier list */
 void
diff --git a/src/feature/relay/ext_orport.h b/src/feature/relay/ext_orport.h
index cf13c5d42..b09fe3b57 100644
--- a/src/feature/relay/ext_orport.h
+++ b/src/feature/relay/ext_orport.h
@@ -38,8 +38,6 @@ int connection_ext_or_start_auth(or_connection_t *or_conn);
 void connection_or_set_ext_or_identifier(or_connection_t *conn);
 void connection_or_remove_from_ext_or_id_map(or_connection_t *conn);
 void connection_or_clear_ext_or_id_map(void);
-or_connection_t *connection_or_get_by_ext_or_id(const char *id);
-
 int connection_ext_or_finished_flushing(or_connection_t *conn);
 int connection_ext_or_process_inbuf(or_connection_t *or_conn);
 
@@ -91,9 +89,11 @@ STATIC int handle_client_auth_nonce(const char *client_nonce,
                          size_t client_nonce_len,
                          char **client_hash_out,
                          char **reply_out, size_t *reply_len_out);
+
 #ifdef TOR_UNIT_TESTS
 extern uint8_t *ext_or_auth_cookie;
 extern int ext_or_auth_cookie_is_set;
+or_connection_t *connection_or_get_by_ext_or_id(const char *id);
 #endif
 #endif /* defined(EXT_ORPORT_PRIVATE) */
 





More information about the tor-commits mailing list