summaryrefslogtreecommitdiff
path: root/src/or/directory.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-12-24 02:45:35 +0000
committerNick Mathewson <nickm@torproject.org>2006-12-24 02:45:35 +0000
commit9efdf6acc52efa5af5a2559f14b45718874a0cda (patch)
treeaaf196d1b5b8a6f03145064eec8495f8a7bd0b08 /src/or/directory.c
parent4d948281c37569dd94496686cc8c3c3f81f65ffd (diff)
downloadtor-9efdf6acc52efa5af5a2559f14b45718874a0cda.tar.gz
tor-9efdf6acc52efa5af5a2559f14b45718874a0cda.zip
r11677@Kushana: nickm | 2006-12-23 21:17:54 -0500
Track when we get 503s from directory servers. Do not use directory servers that have given us a 503 until either an hour has passed, or we are are out of non-busy servers. svn:r9172
Diffstat (limited to 'src/or/directory.c')
-rw-r--r--src/or/directory.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index a38aada299..78a4f23a62 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -109,7 +109,7 @@ directory_post_to_dirservers(uint8_t purpose, const char *payload,
*/
SMARTLIST_FOREACH(dirservers, trusted_dir_server_t *, ds,
{
- routerstatus_t *rs = &(ds->fake_status);
+ routerstatus_t *rs = &(ds->fake_status.status);
if (post_to_hidserv_only && !ds->is_hidserv_authority)
continue;
if (!post_to_hidserv_only &&
@@ -921,10 +921,18 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
(void) skewed; /* skewed isn't used yet. */
if (status_code == 503) {
+ local_routerstatus_t *rs;
+ trusted_dir_server_t *ds;
+ time_t now = time(NULL);
log_info(LD_DIR,"Received http status code %d (%s) from server "
"'%s:%d'. I'll try again soon.",
status_code, escaped(reason), conn->_base.address,
conn->_base.port);
+ if ((rs = router_get_combined_status_by_digest(conn->identity_digest)))
+ rs->last_dir_503_at = now;
+ if ((ds = router_get_trusteddirserver_by_digest(conn->identity_digest)))
+ ds->fake_status.last_dir_503_at = now;
+
tor_free(body); tor_free(headers); tor_free(reason);
return -1;
}