[tor-commits] [tor/master] circuitbuild: Make some functions mockable

nickm at torproject.org nickm at torproject.org
Thu Apr 9 15:56:22 UTC 2020


commit 42fdbbb50bbb9d0f2e15012256a088f3f1c22f8d
Author: teor <teor at torproject.org>
Date:   Fri Apr 3 19:01:19 2020 +1000

    circuitbuild: Make some functions mockable
    
    Part of 33633.
---
 src/core/or/circuitbuild.c |  8 ++++----
 src/core/or/circuitbuild.h | 12 ++++++------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/core/or/circuitbuild.c b/src/core/or/circuitbuild.c
index 0527548f2..71a51e61a 100644
--- a/src/core/or/circuitbuild.c
+++ b/src/core/or/circuitbuild.c
@@ -95,10 +95,10 @@ static const node_t *choose_good_middle_server(uint8_t purpose,
  * and then calls command_setup_channel() to give it the right
  * callbacks.
  */
-channel_t *
-channel_connect_for_circuit(const tor_addr_t *addr, uint16_t port,
-                            const char *id_digest,
-                            const struct ed25519_public_key_t *ed_id)
+MOCK_IMPL(channel_t *,
+channel_connect_for_circuit,(const tor_addr_t *addr, uint16_t port,
+                             const char *id_digest,
+                             const struct ed25519_public_key_t *ed_id))
 {
   channel_t *chan;
 
diff --git a/src/core/or/circuitbuild.h b/src/core/or/circuitbuild.h
index c66c0dc75..cf9999092 100644
--- a/src/core/or/circuitbuild.h
+++ b/src/core/or/circuitbuild.h
@@ -73,13 +73,13 @@ void circuit_upgrade_circuits_from_guard_wait(void);
 
 struct ed25519_public_key_t;
 
-channel_t *
-channel_connect_for_circuit(const tor_addr_t *addr,
-                            uint16_t port,
-                            const char *id_digest,
-                            const struct ed25519_public_key_t *ed_id);
-struct create_cell_t;
+MOCK_DECL(channel_t *,
+channel_connect_for_circuit,(const tor_addr_t *addr,
+                             uint16_t port,
+                             const char *id_digest,
+                             const struct ed25519_public_key_t *ed_id));
 
+struct create_cell_t;
 int
 circuit_deliver_create_cell(circuit_t *circ,
                             const struct create_cell_t *create_cell,





More information about the tor-commits mailing list