summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-01-03 19:51:10 +0000
committerNick Mathewson <nickm@torproject.org>2005-01-03 19:51:10 +0000
commit5f40d6bf729522e8de88845d145672285ad3800b (patch)
tree15c1be1cb9152e16006d4baf6d180aef4205de5d
parentb50263f740e601654ef8cd417d6189dd07bb27d6 (diff)
downloadtor-5f40d6bf729522e8de88845d145672285ad3800b.tar.gz
tor-5f40d6bf729522e8de88845d145672285ad3800b.zip
Make directory fail-and-retry logic happen in connection_about_to_close(); fixes win32 bug.
svn:r3253
-rw-r--r--src/or/connection.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index d6d7bd168d..2a038e29cb 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -205,6 +205,17 @@ void connection_about_to_close_connection(connection_t *conn)
switch (conn->type) {
case CONN_TYPE_DIR:
+ if (conn->state == DIR_CONN_STATE_CONNECTING) {
+ /* it's a directory server and connecting failed: forget about
+ this router */
+ router_mark_as_down(conn->identity_digest);
+ if (conn->purpose == DIR_PURPOSE_FETCH_DIR &&
+ !all_trusted_directory_servers_down()) {
+ log_fn(LOG_INFO,"Giving up on dirserver %s; trying another.",
+ conn->address);
+ directory_get_from_dirserver(DIR_PURPOSE_FETCH_DIR, NULL);
+ }
+ }
if (conn->purpose == DIR_PURPOSE_FETCH_RENDDESC)
rend_client_desc_fetched(conn->rend_query, 0);
break;
@@ -854,17 +865,6 @@ loop_again:
conn->cpath_layer);
}
connection_mark_for_close(conn);
- if (conn->type == CONN_TYPE_DIR &&
- conn->state == DIR_CONN_STATE_CONNECTING) {
- /* it's a directory server and connecting failed: forget about this router */
- /* XXX I suspect pollerr may make Windows not get to this point. :( */
- router_mark_as_down(conn->identity_digest);
- if (conn->purpose == DIR_PURPOSE_FETCH_DIR &&
- !all_trusted_directory_servers_down()) {
- log_fn(LOG_INFO,"Giving up on dirserver %s; trying another.", conn->address);
- directory_get_from_dirserver(DIR_PURPOSE_FETCH_DIR, NULL);
- }
- }
return -1;
}
if (CONN_IS_EDGE(conn) &&