aboutsummaryrefslogtreecommitdiff
path: root/src/or/directory.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2005-02-10 06:31:34 +0000
committerRoger Dingledine <arma@torproject.org>2005-02-10 06:31:34 +0000
commit37ca621301134d567fbaa7cbbc84b3c10807726c (patch)
treee5282fe9011a0f2d4b62e83a541d468425256b93 /src/or/directory.c
parent1ebebff1a0a8d7808c6734cc7c84f61ceb08c837 (diff)
downloadtor-37ca621301134d567fbaa7cbbc84b3c10807726c.tar
tor-37ca621301134d567fbaa7cbbc84b3c10807726c.tar.gz
when a client asks us for a dir mirror and we don't have one,
launch an attempt to get a fresh one. svn:r3609
Diffstat (limited to 'src/or/directory.c')
-rw-r--r--src/or/directory.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index 29e86d762..6cb6b64c9 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -876,6 +876,9 @@ directory_handle_command_get(connection_t *conn, char *headers,
if (dlen == 0) {
log_fn(LOG_NOTICE,"Client asked for the mirrored directory, but we don't have a good one yet. Sending 503 Dir not available.");
write_http_status_line(conn, 503, "Directory unavailable");
+ /* try to get a new one now */
+ if (!connection_get_by_type_purpose(CONN_TYPE_DIR, DIR_PURPOSE_FETCH_DIR))
+ directory_get_from_dirserver(DIR_PURPOSE_FETCH_DIR, NULL, 1);
return 0;
}
@@ -898,6 +901,10 @@ directory_handle_command_get(connection_t *conn, char *headers,
dlen = dirserv_get_runningrouters(&cp, deflated);
if (!dlen) { /* we failed to create/cache cp */
write_http_status_line(conn, 503, "Directory unavailable");
+ /* try to get a new one now */
+ if (!connection_get_by_type_purpose(CONN_TYPE_DIR,
+ DIR_PURPOSE_FETCH_RUNNING_LIST))
+ directory_get_from_dirserver(DIR_PURPOSE_FETCH_RUNNING_LIST, NULL, 1);
return 0;
}