diff options
Diffstat (limited to 'src/or/directory.c')
-rw-r--r-- | src/or/directory.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index e768f1d00a..2bc6578eb1 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -1244,7 +1244,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn) (int)body_len, status_code, escaped(reason)); switch (status_code) { case 200: - if (rend_cache_store(body, body_len) < 0) { + if (rend_cache_store(body, body_len, 0) < 0) { log_warn(LD_REND,"Failed to store rendezvous descriptor."); /* alice's ap_stream will notice when connection_mark_for_close * cleans it up */ @@ -1771,9 +1771,18 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers, note_request("/tor/rendezvous?/", desc_len); /* need to send descp separately, because it may include nuls */ connection_write_to_buf(descp, desc_len, TO_CONN(conn)); + /* report successful fetch to statistic */ + if (options->HSAuthorityRecordStats) { + hs_usage_note_fetch_total(query, time(NULL)); + hs_usage_note_fetch_successful(query, time(NULL)); + } break; case 0: /* well-formed but not present */ write_http_status_line(conn, 404, "Not found"); + /* report (unsuccessful) fetch to statistic */ + if (options->HSAuthorityRecordStats) { + hs_usage_note_fetch_total(query, time(NULL)); + } break; case -1: /* not well-formed */ write_http_status_line(conn, 400, "Bad request"); @@ -1890,7 +1899,7 @@ directory_handle_command_post(dir_connection_t *conn, const char *headers, if (options->HSAuthoritativeDir && !strcmpstart(url,"/tor/rendezvous/publish")) { /* rendezvous descriptor post */ - if (rend_cache_store(body, body_len) < 0) { + if (rend_cache_store(body, body_len, 1) < 0) { // char tmp[1024*2+1]; log_fn(LOG_PROTOCOL_WARN, LD_DIRSERV, "Rejected rend descriptor (length %d) from %s.", |