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.
This commit is contained in:
Karsten Loesing 2009-06-12 11:39:35 +02:00
parent 77f5ad6b07
commit 6a32beb877
2 changed files with 13 additions and 16 deletions

View File

@ -13,6 +13,13 @@ Changes in version 0.2.2.1-alpha - 2009-??-??
- Directories that are configured with the --enable-geoip-stats flag - Directories that are configured with the --enable-geoip-stats flag
now write their GeoIP stats to disk exactly every 24 hours. 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.
o Deprecated and removed features: o Deprecated and removed features:
- The controller no longer accepts the old obsolete "addr-mappings/" - The controller no longer accepts the old obsolete "addr-mappings/"
GETINFO value. GETINFO value.

View File

@ -1678,22 +1678,12 @@ connection_ap_handshake_rewrite_and_attach(edge_connection_t *conn,
safe_str(conn->rend_data->onion_address)); safe_str(conn->rend_data->onion_address));
rend_client_refetch_v2_renddesc(conn->rend_data); rend_client_refetch_v2_renddesc(conn->rend_data);
} else { /* r > 0 */ } else { /* r > 0 */
/** How long after we receive a hidden service descriptor do we consider conn->_base.state = AP_CONN_STATE_CIRCUIT_WAIT;
* it valid? */ log_info(LD_REND, "Descriptor is here. Great.");
#define NUM_SECONDS_BEFORE_HS_REFETCH (60*15) if (connection_ap_handshake_attach_circuit(conn) < 0) {
if (now - entry->received < NUM_SECONDS_BEFORE_HS_REFETCH) { if (!conn->_base.marked_for_close)
conn->_base.state = AP_CONN_STATE_CIRCUIT_WAIT; connection_mark_unattached_ap(conn, END_STREAM_REASON_CANT_ATTACH);
log_info(LD_REND, "Descriptor is here and fresh enough. Great."); return -1;
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);
} }
} }
return 0; return 0;