diff options
author | Karsten Loesing <karsten.loesing@gmx.net> | 2009-06-12 11:39:35 +0200 |
---|---|---|
committer | Karsten Loesing <karsten.loesing@gmx.net> | 2009-06-12 11:39:35 +0200 |
commit | 6a32beb8771d94dd35460ce391eeb4455f2ada3f (patch) | |
tree | fc087bae376a81a42a89d88ec1346c3316d4e266 /src/or/connection_edge.c | |
parent | 77f5ad6b07dcdd3271d56f5e9edde3dc56ffe411 (diff) | |
download | tor-6a32beb8771d94dd35460ce391eeb4455f2ada3f.tar.gz tor-6a32beb8771d94dd35460ce391eeb4455f2ada3f.zip |
Apply fix for bug 997.
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.
Diffstat (limited to 'src/or/connection_edge.c')
-rw-r--r-- | src/or/connection_edge.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 6207ad3178..fe25c25c58 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; |