[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r13251: start to clean up r13250: retry v2 renddesc fetches when we (tor/trunk/src/or)
Author: arma
Date: 2008-01-23 23:45:30 -0500 (Wed, 23 Jan 2008)
New Revision: 13251
Modified:
tor/trunk/src/or/connection.c
tor/trunk/src/or/directory.c
Log:
start to clean up r13250: retry v2 renddesc fetches when we
fail to reach the dirserver too.
Modified: tor/trunk/src/or/connection.c
===================================================================
--- tor/trunk/src/or/connection.c 2008-01-24 03:28:50 UTC (rev 13250)
+++ tor/trunk/src/or/connection.c 2008-01-24 04:45:30 UTC (rev 13251)
@@ -468,10 +468,12 @@
/* 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);
Modified: tor/trunk/src/or/directory.c
===================================================================
--- tor/trunk/src/or/directory.c 2008-01-24 03:28:50 UTC (rev 13250)
+++ tor/trunk/src/or/directory.c 2008-01-24 04:45:30 UTC (rev 13251)
@@ -1763,13 +1763,11 @@
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 @@
}
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 @@
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 @@
}
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 @@
"Retrying at another directory.",
status_code, escaped(reason), conn->_base.address,
conn->_base.port);
- rend_client_refetch_v2_renddesc(conn->rend_query);
break;
}
}