diff options
author | David Goulet <dgoulet@ev0ke.net> | 2015-02-24 16:17:14 -0500 |
---|---|---|
committer | David Goulet <dgoulet@ev0ke.net> | 2015-04-21 14:15:02 -0400 |
commit | 7db58445fd00d5bbad72fd80497d20b7bc9a0297 (patch) | |
tree | 6cfb5f909e1ece90915ca9f10d3b869b2943df05 /src/or/directory.c | |
parent | 084be23697e14b9ee26b3ac1eef2448af6368d10 (diff) | |
download | tor-7db58445fd00d5bbad72fd80497d20b7bc9a0297.tar.gz tor-7db58445fd00d5bbad72fd80497d20b7bc9a0297.zip |
Control: add HS_DESC_CONTENT event
As defined in section 4.1.26 in the control-spec.txt, this new event replies
the content of a successfully fetched HS descriptor. This also adds a unit
test for the controller event.
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
Diffstat (limited to 'src/or/directory.c')
-rw-r--r-- | src/or/directory.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index d2b6b86f6d..b6b0a5d7e0 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -2102,6 +2102,11 @@ connection_dir_client_reached_eof(dir_connection_t *conn) control_event_hs_descriptor_failed(conn->rend_data, \ conn->identity_digest, \ reason) ) + #define SEND_HS_DESC_FAILED_CONTENT() ( \ + control_event_hs_descriptor_content(conn->rend_data->onion_address, \ + conn->requested_resource, \ + conn->identity_digest, \ + "") ) tor_assert(conn->rend_data); log_info(LD_REND,"Received rendezvous descriptor (size %d, status %d " "(%s))", @@ -2117,6 +2122,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn) /* We'll retry when connection_about_to_close_connection() * cleans this dir conn up. */ SEND_HS_DESC_FAILED_EVENT("BAD_DESC"); + SEND_HS_DESC_FAILED_CONTENT(); break; case RCS_OKAY: default: @@ -2125,6 +2131,10 @@ connection_dir_client_reached_eof(dir_connection_t *conn) "descriptor."); control_event_hs_descriptor_received(conn->rend_data, conn->identity_digest); + control_event_hs_descriptor_content(conn->rend_data->onion_address, + conn->requested_resource, + conn->identity_digest, + body); conn->base_.purpose = DIR_PURPOSE_HAS_FETCHED_RENDDESC_V2; rend_client_desc_trynow(conn->rend_data->onion_address); break; @@ -2136,6 +2146,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn) log_info(LD_REND,"Fetching v2 rendezvous descriptor failed: " "Retrying at another directory."); SEND_HS_DESC_FAILED_EVENT("NOT_FOUND"); + SEND_HS_DESC_FAILED_CONTENT(); break; case 400: log_warn(LD_REND, "Fetching v2 rendezvous descriptor failed: " @@ -2143,6 +2154,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn) "v2 rendezvous query? Retrying at another directory.", escaped(reason)); SEND_HS_DESC_FAILED_EVENT("QUERY_REJECTED"); + SEND_HS_DESC_FAILED_CONTENT(); break; default: log_warn(LD_REND, "Fetching v2 rendezvous descriptor failed: " @@ -2152,6 +2164,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn) status_code, escaped(reason), conn->base_.address, conn->base_.port); SEND_HS_DESC_FAILED_EVENT("UNEXPECTED"); + SEND_HS_DESC_FAILED_CONTENT(); break; } } |