diff options
author | George Kadianakis <desnacked@riseup.net> | 2017-05-02 16:22:00 +0300 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-07-07 11:12:26 -0400 |
commit | 9ff5613a340f220a202d3f0332f091d812068881 (patch) | |
tree | 903fd8ab7b5bcd9c11752db72f5be36fa83ce1f8 /src/or/hs_client.c | |
parent | 0cb66fc900f5198fb063454801af3b4b22867e50 (diff) | |
download | tor-9ff5613a340f220a202d3f0332f091d812068881.tar.gz tor-9ff5613a340f220a202d3f0332f091d812068881.zip |
test: Introduce hs_client_note_connection_attempt_succeeded().
This commit paves the way for the e2e circuit unittests.
Add a stub for the prop224 equivalent of rend_client_note_connection_attempt_ended().
That function was needed for tests, since the legacy function would get
called when we attach streams and our client-side tests would crash with
assert failures on rend_data.
This also introduces hs_client.[ch] to the codebase.
Diffstat (limited to 'src/or/hs_client.c')
-rw-r--r-- | src/or/hs_client.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/or/hs_client.c b/src/or/hs_client.c new file mode 100644 index 0000000000..12fcf3a491 --- /dev/null +++ b/src/or/hs_client.c @@ -0,0 +1,47 @@ +/* Copyright (c) 2016-2017, The Tor Project, Inc. */ +/* See LICENSE for licensing information */ + +/** + * \file hs_service.c + * \brief Implement next generation hidden service client functionality + **/ + +#include "or.h" +#include "hs_circuit.h" +#include "connection_edge.h" +#include "rendclient.h" + +#include "hs_client.h" + +/** A prop224 v3 HS circuit successfully connected to the hidden + * service. Update the stream state at <b>hs_conn_ident</b> appropriately. */ +static void +hs_client_attempt_succeeded(const hs_ident_edge_conn_t *hs_conn_ident) +{ + (void) hs_conn_ident; + + /* TODO: When implementing client side */ + return; +} + +/** A circuit just finished connecting to a hidden service that the stream + * <b>conn</b> has been waiting for. Let the HS subsystem know about this. */ +void +hs_client_note_connection_attempt_succeeded(const edge_connection_t *conn) +{ + tor_assert(connection_edge_is_rendezvous_stream(conn)); + + if (BUG(conn->rend_data && conn->hs_ident)) { + log_warn(LD_BUG, "Stream had both rend_data and hs_ident..." + "Prioritizing hs_ident"); + } + + if (conn->hs_ident) { /* It's v3: pass it to the prop224 handler */ + hs_client_attempt_succeeded(conn->hs_ident); + return; + } else if (conn->rend_data) { /* It's v2: pass it to the legacy handler */ + rend_client_note_connection_attempt_ended(conn->rend_data); + return; + } +} + |