diff options
author | Qingping Hou <dave2008713@gmail.com> | 2013-10-09 11:13:06 -0400 |
---|---|---|
committer | Qingping Hou <dave2008713@gmail.com> | 2014-01-29 22:23:57 -0500 |
commit | 29c18f5b71d73a03b9895fbbf97a3a5a16099a50 (patch) | |
tree | 3e59a10e4a958de118075a05aebd298db5f40993 /src/or/directory.c | |
parent | 3b38fd87e812a104f835af59abeda012928e21b7 (diff) | |
download | tor-29c18f5b71d73a03b9895fbbf97a3a5a16099a50.tar.gz tor-29c18f5b71d73a03b9895fbbf97a3a5a16099a50.zip |
add hidden service descriptor async control event
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 12c5b189f4..2b93625f28 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -1660,17 +1660,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; @@ -2275,6 +2275,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))", @@ -2287,6 +2291,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 @@ -2299,6 +2304,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; @@ -2309,12 +2317,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: " @@ -2323,6 +2333,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; } } |