summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2008-01-24 04:45:30 +0000
committerRoger Dingledine <arma@torproject.org>2008-01-24 04:45:30 +0000
commitc973eb5e2326fb64cdddb1b0badc355c459f8fee (patch)
treea390bd0a16e70ba1dbde058e4e99fb058ddb6a9c
parent6b1374556e877478f8bf0d394b379a8e29513967 (diff)
downloadtor-c973eb5e2326fb64cdddb1b0badc355c459f8fee.tar.gz
tor-c973eb5e2326fb64cdddb1b0badc355c459f8fee.zip
start to clean up r13250: retry v2 renddesc fetches when we
fail to reach the dirserver too. svn:r13251
-rw-r--r--src/or/connection.c6
-rw-r--r--src/or/directory.c33
2 files changed, 15 insertions, 24 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index 5c0ee12fd1..e64a623ff1 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -468,10 +468,12 @@ connection_about_to_close_connection(connection_t *conn)
/* It's a directory connection and connecting or fetching
* failed: forget about this router, and maybe try again. */
connection_dir_request_failed(dir_conn);
- // XXX if it's rend desc we may want to retry -RD
}
+ /* if we were trying to fetch a rend desc, retry as needed */
if (conn->purpose == DIR_PURPOSE_FETCH_RENDDESC)
- rend_client_desc_here(dir_conn->rend_query); /* give it a try */
+ rend_client_desc_here(dir_conn->rend_query);
+ if (conn->purpose == DIR_PURPOSE_FETCH_RENDDESC_V2)
+ rend_client_refetch_v2_renddesc(dir_conn->rend_query);
break;
case CONN_TYPE_OR:
or_conn = TO_OR_CONN(conn);
diff --git a/src/or/directory.c b/src/or/directory.c
index b1f7b759e6..c44948cdb8 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -1763,13 +1763,11 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
case 200:
if (rend_cache_store(body, body_len, 0) < 0) {
log_warn(LD_REND,"Failed to fetch rendezvous descriptor.");
- /* alice's ap_stream will notice when connection_mark_for_close
- * cleans it up */
- /*XXXX020 maybe retry quickly; timeout takes a while. */
- /* This would require some kind of book-keeping which directories
- * have been requested and which not. As directory servers are
- * rather reliable, this should not be necessary, in constrast to
- * v2 hidden service directories. -KL */
+ /* Any pending rendezvous attempts will notice when
+ * connection_about_to_close_connection()
+ * cleans this dir conn up. */
+ /* We could retry. But since v0 descriptors are going out of
+ * style, it isn't worth the hassle. We'll do better in v2. */
} else {
/* success. notify pending connections about this. */
conn->_base.purpose = DIR_PURPOSE_HAS_FETCHED_RENDDESC;
@@ -1777,13 +1775,8 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
}
break;
case 404:
- /* not there. pending connections will be notified when
- * connection_mark_for_close cleans it up. */
- /*XXXX020 maybe retry quickly; timeout takes a while. */
- /* This would require some kind of book-keeping which directories
- * have been requested and which not. As directory servers are
- * rather reliable, this should not be necessary, in constrast to
- * v2 hidden service directories. -KL */
+ /* Not there. Pending connections will be notified when
+ * connection_about_to_close_connection() cleans this conn up. */
break;
case 400:
log_warn(LD_REND,
@@ -1808,9 +1801,8 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
if (rend_cache_store_v2_desc_as_client(body, NULL) < 0) {
log_warn(LD_REND,"Fetching v2 rendezvous descriptor failed. "
"Retrying at another directory.");
- /* alice's ap_stream will notice when connection_mark_for_close
- * cleans it up */
- rend_client_refetch_v2_renddesc(conn->rend_query);
+ /* We'll retry when connection_about_to_close_connection()
+ * cleans this dir conn up. */
} else {
/* success. notify pending connections about this. */
log_info(LD_REND, "Successfully fetched rendezvous descriptor.");
@@ -1819,18 +1811,16 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
}
break;
case 404:
- /* not there. pending connections will be notified when
- * connection_mark_for_close cleans it up. */
+ /* Not there. We'll retry when
+ * connection_about_to_close_connection() cleans this conn up. */
log_info(LD_REND,"Fetching v2 rendezvous descriptor failed: "
"Retrying at another directory.");
- rend_client_refetch_v2_renddesc(conn->rend_query);
break;
case 400:
log_warn(LD_REND, "Fetching v2 rendezvous descriptor failed: "
"http status 400 (%s). Dirserver didn't like our "
"v2 rendezvous query? Retrying at another directory.",
escaped(reason));
- rend_client_refetch_v2_renddesc(conn->rend_query);
break;
default:
log_warn(LD_REND, "Fetching v2 rendezvous descriptor failed: "
@@ -1839,7 +1829,6 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
"Retrying at another directory.",
status_code, escaped(reason), conn->_base.address,
conn->_base.port);
- rend_client_refetch_v2_renddesc(conn->rend_query);
break;
}
}