diff options
author | Roger Dingledine <arma@torproject.org> | 2008-02-17 16:47:47 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2008-02-17 16:47:47 +0000 |
commit | bd959adcb7d7c671e0f36986d4996d5b3bc298e6 (patch) | |
tree | 2a4f501e00d897d756492c06eec4aebc88d368af /src/or/rendclient.c | |
parent | 6366dcd8eebbd6da71a36d20aab156ca9842f001 (diff) | |
download | tor-bd959adcb7d7c671e0f36986d4996d5b3bc298e6.tar.gz tor-bd959adcb7d7c671e0f36986d4996d5b3bc298e6.zip |
patch from karsten:
Resolved problems with (re-)fetching hidden service descriptors.
Before, v0 descriptors were not fetched at all (fix on 0.2.0.18-alpha),
re-fetching of v2 descriptors did not stop when a v0 descriptor was
received (fix on 0.2.0.18-alpha), and re-fetching of v2 descriptors did
not work in all cases (fix on 0.2.0.19-alpha).
svn:r13540
Diffstat (limited to 'src/or/rendclient.c')
-rw-r--r-- | src/or/rendclient.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/or/rendclient.c b/src/or/rendclient.c index b30be2310e..6e92ef50b0 100644 --- a/src/or/rendclient.c +++ b/src/or/rendclient.c @@ -401,7 +401,7 @@ rend_client_refetch_renddesc(const char *query) return; log_info(LD_REND, "Fetching rendezvous descriptor for service %s", escaped_safe_str(query)); - if (connection_get_by_type_state_rendquery(CONN_TYPE_DIR, 0, query)) { + if (connection_get_by_type_state_rendquery(CONN_TYPE_DIR, 0, query, 0)) { log_info(LD_REND,"Would fetch a new renddesc here (for %s), but one is " "already in progress.", escaped_safe_str(query)); } else { @@ -421,6 +421,7 @@ rend_client_refetch_v2_renddesc(const char *query) char descriptor_id[DIGEST_LEN]; int replicas_left_to_try[REND_NUMBER_OF_NON_CONSECUTIVE_REPLICAS]; int i, tries_left; + rend_cache_entry_t *e = NULL; tor_assert(query); tor_assert(strlen(query) == REND_SERVICE_ID_LEN_BASE32); /* Are we configured to fetch descriptors? */ @@ -429,6 +430,12 @@ rend_client_refetch_v2_renddesc(const char *query) "service descriptor, but are not fetching service descriptors."); return; } + /* Before fetching, check if we already have the descriptor here. */ + if (rend_cache_lookup_entry(query, -1, &e) > 0) { + log_info(LD_REND, "We would fetch a v2 rendezvous descriptor, but we " + "already have that descriptor here. Not fetching."); + return; + } log_debug(LD_REND, "Fetching v2 rendezvous descriptor for service %s", safe_str(query)); /* Randomly iterate over the replicas until a descriptor can be fetched @@ -506,7 +513,7 @@ rend_client_remove_intro_point(extend_info_t *failed_intro, const char *query) /* move all pending streams back to renddesc_wait */ while ((conn = connection_get_by_type_state_rendquery(CONN_TYPE_AP, - AP_CONN_STATE_CIRCUIT_WAIT, query))) { + AP_CONN_STATE_CIRCUIT_WAIT, query, -1))) { conn->state = AP_CONN_STATE_RENDDESC_WAIT; } |