diff options
author | Nick Mathewson <nickm@torproject.org> | 2009-06-16 16:26:02 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2009-06-16 16:26:02 -0400 |
commit | df03d6eca8d8bda9afc848f85dd32428826bfc41 (patch) | |
tree | 43c23cd10923ec455837e64d489a54d3fe51bd3d | |
parent | 0d2976d64b43083e1f036ecca6a8c9634830f0e9 (diff) | |
parent | ca8708a9ce3f8e6a4b3aadf2e35edfd2b49c1a2d (diff) | |
download | tor-df03d6eca8d8bda9afc848f85dd32428826bfc41.tar.gz tor-df03d6eca8d8bda9afc848f85dd32428826bfc41.zip |
Merge commit 'karsten/bug997-hidservfetch'
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | src/or/connection_edge.c | 22 | ||||
-rw-r--r-- | src/or/rendclient.c | 7 | ||||
-rw-r--r-- | src/or/rendcommon.c | 5 |
4 files changed, 23 insertions, 20 deletions
@@ -18,6 +18,15 @@ Changes in version 0.2.2.1-alpha - 2009-??-?? - Directories that are configured with the --enable-geoip-stats flag now write their GeoIP stats to disk exactly every 24 hours. + o Minor bugfixes + - Hidden service clients didn't use a cached service descriptor that + was older than 15 minutes, but wouldn't fetch a new one either. Now, + use a cached descriptor no matter how old it is and only fetch a new + one when all introduction points fail. Fix for bug 997. Patch from + Marcus Griep. + - Fix refetching of hidden service descriptors when all introduction + points have turned out to not work. Fixes more of bug 997. + o Deprecated and removed features: - The controller no longer accepts the old obsolete "addr-mappings/" GETINFO value. diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 5600d52aaf..3cd00e2828 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -1678,22 +1678,12 @@ connection_ap_handshake_rewrite_and_attach(edge_connection_t *conn, safe_str(conn->rend_data->onion_address)); rend_client_refetch_v2_renddesc(conn->rend_data); } else { /* r > 0 */ -/** How long after we receive a hidden service descriptor do we consider - * it valid? */ -#define NUM_SECONDS_BEFORE_HS_REFETCH (60*15) - if (now - entry->received < NUM_SECONDS_BEFORE_HS_REFETCH) { - conn->_base.state = AP_CONN_STATE_CIRCUIT_WAIT; - log_info(LD_REND, "Descriptor is here and fresh enough. Great."); - if (connection_ap_handshake_attach_circuit(conn) < 0) { - if (!conn->_base.marked_for_close) - connection_mark_unattached_ap(conn, END_STREAM_REASON_CANT_ATTACH); - return -1; - } - } else { - conn->_base.state = AP_CONN_STATE_RENDDESC_WAIT; - log_info(LD_REND, "Stale descriptor %s. Re-fetching.", - safe_str(conn->rend_data->onion_address)); - rend_client_refetch_v2_renddesc(conn->rend_data); + conn->_base.state = AP_CONN_STATE_CIRCUIT_WAIT; + log_info(LD_REND, "Descriptor is here. Great."); + if (connection_ap_handshake_attach_circuit(conn) < 0) { + if (!conn->_base.marked_for_close) + connection_mark_unattached_ap(conn, END_STREAM_REASON_CANT_ATTACH); + return -1; } } return 0; diff --git a/src/or/rendclient.c b/src/or/rendclient.c index d9c0a9e713..00b77d8370 100644 --- a/src/or/rendclient.c +++ b/src/or/rendclient.c @@ -447,10 +447,9 @@ directory_get_from_hs_dir(const char *desc_id, const rend_data_t *rend_query) return 1; } -/** Start a connection to a hidden service directory to fetch a v2 - * rendezvous service descriptor for the base32-encoded service ID - * <b>query</b>. - */ +/** Unless we already have a descriptor for <b>rend_query</b> with at least + * one (possibly) working introduction point in it, start a connection to a + * hidden service directory to fetch a v2 rendezvous service descriptor. */ void rend_client_refetch_v2_renddesc(const rend_data_t *rend_query) { diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c index c813c4959d..df7195e3ea 100644 --- a/src/or/rendcommon.c +++ b/src/or/rendcommon.c @@ -911,6 +911,11 @@ rend_cache_lookup_entry(const char *query, int version, rend_cache_entry_t **e) } if (!*e) return 0; + tor_assert((*e)->parsed && (*e)->parsed->intro_nodes); + /* XXX022 hack for now, to return "not found" if there are no intro + * points remaining. See bug 997. */ + if (smartlist_len((*e)->parsed->intro_nodes) == 0) + return 0; return 1; } |