diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-02-03 12:28:42 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-02-03 12:28:42 -0500 |
commit | fee7f25ff845dc9a99dac59e67fdb9517750176c (patch) | |
tree | 8d77a633b56c05939cfff901a2f942da217ba99b /src/or/directory.c | |
parent | 27d81c756b0e28266e75cf4cf897e486d11040b2 (diff) | |
parent | ebd99314cff907433eca835926a325c019f4b6c0 (diff) | |
download | tor-fee7f25ff845dc9a99dac59e67fdb9517750176c.tar.gz tor-fee7f25ff845dc9a99dac59e67fdb9517750176c.zip |
Merge remote-tracking branch 'houqp/hs_control'
Diffstat (limited to 'src/or/directory.c')
-rw-r--r-- | src/or/directory.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index 37a476d1cf..0cacf06617 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -1599,17 +1599,17 @@ connection_dir_client_reached_eof(dir_connection_t *conn) char *body; char *headers; char *reason = NULL; - size_t body_len=0, orig_len=0; + size_t body_len = 0, orig_len = 0; int status_code; - time_t date_header=0; + time_t date_header = 0; long delta; compress_method_t compression; int plausible; - int skewed=0; + int skewed = 0; int allow_partial = (conn->base_.purpose == DIR_PURPOSE_FETCH_SERVERDESC || conn->base_.purpose == DIR_PURPOSE_FETCH_EXTRAINFO || conn->base_.purpose == DIR_PURPOSE_FETCH_MICRODESC); - int was_compressed=0; + int was_compressed = 0; time_t now = time(NULL); int src_code; @@ -2143,6 +2143,10 @@ connection_dir_client_reached_eof(dir_connection_t *conn) } if (conn->base_.purpose == DIR_PURPOSE_FETCH_RENDDESC_V2) { + #define SEND_HS_DESC_FAILED_EVENT() ( \ + control_event_hs_descriptor_failed(conn->rend_data, \ + node_describe_by_id( \ + conn->identity_digest)) ) tor_assert(conn->rend_data); log_info(LD_REND,"Received rendezvous descriptor (size %d, status %d " "(%s))", @@ -2155,6 +2159,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn) "Retrying at another directory."); /* We'll retry when connection_about_to_close_connection() * cleans this dir conn up. */ + SEND_HS_DESC_FAILED_EVENT(); break; case -1: /* We already have a v0 descriptor here. Ignoring this one @@ -2167,6 +2172,9 @@ connection_dir_client_reached_eof(dir_connection_t *conn) /* success. notify pending connections about this. */ log_info(LD_REND, "Successfully fetched v2 rendezvous " "descriptor."); + control_event_hs_descriptor_received(conn->rend_data, + node_describe_by_id( + conn->identity_digest)); conn->base_.purpose = DIR_PURPOSE_HAS_FETCHED_RENDDESC; rend_client_desc_trynow(conn->rend_data->onion_address); break; @@ -2177,12 +2185,14 @@ connection_dir_client_reached_eof(dir_connection_t *conn) * connection_about_to_close_connection() cleans this conn up. */ log_info(LD_REND,"Fetching v2 rendezvous descriptor failed: " "Retrying at another directory."); + SEND_HS_DESC_FAILED_EVENT(); break; case 400: log_warn(LD_REND, "Fetching v2 rendezvous descriptor failed: " "http status 400 (%s). Dirserver didn't like our " "v2 rendezvous query? Retrying at another directory.", escaped(reason)); + SEND_HS_DESC_FAILED_EVENT(); break; default: log_warn(LD_REND, "Fetching v2 rendezvous descriptor failed: " @@ -2191,6 +2201,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn) "Retrying at another directory.", status_code, escaped(reason), conn->base_.address, conn->base_.port); + SEND_HS_DESC_FAILED_EVENT(); break; } } |