aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection_edge.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-04-07 22:41:00 +0000
committerRoger Dingledine <arma@torproject.org>2004-04-07 22:41:00 +0000
commite79a578feca34e01d4d71fa5c824f84fe649993a (patch)
tree7ac5a35bff036d0e4b1695f7ac8615315cbd4923 /src/or/connection_edge.c
parent09e66bbd14ed1f59cf5a79f179536b7f8be87487 (diff)
downloadtor-e79a578feca34e01d4d71fa5c824f84fe649993a.tar
tor-e79a578feca34e01d4d71fa5c824f84fe649993a.tar.gz
if the rend desc cache entry was fetched more than 15 mins ago,
then try to fetch a new one. but if the new fetch fails, use the old one. svn:r1540
Diffstat (limited to 'src/or/connection_edge.c')
-rw-r--r--src/or/connection_edge.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 36b57c064..a9cbafa87 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -728,13 +728,14 @@ static int connection_ap_handshake_process_socks(connection_t *conn) {
return connection_ap_handshake_attach_circuit(conn);
} else {
/* it's a hidden-service request */
- const char *descp;
- int desc_len;
+ rend_cache_entry_t *entry;
strcpy(conn->rend_query, socks->address); /* this strcpy is safe -RD */
log_fn(LOG_INFO,"Got a hidden service request for ID '%s'", conn->rend_query);
/* see if we already have it cached */
- if (rend_cache_lookup_desc(conn->rend_query, &descp, &desc_len) == 1) {
+ if (rend_cache_lookup_entry(conn->rend_query, &entry) == 1 &&
+#define NUM_SECONDS_BEFORE_REFETCH (60*15)
+ entry->received + NUM_SECONDS_BEFORE_REFETCH < time(NULL)) {
conn->state = AP_CONN_STATE_CIRCUIT_WAIT;
return connection_ap_handshake_attach_circuit(conn);
} else {