summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-12-15 21:15:16 +0000
committerNick Mathewson <nickm@torproject.org>2005-12-15 21:15:16 +0000
commit713c995adb3fcbdb3a05ac61b2e46f205432dce2 (patch)
tree36a54751a392dd08d88d13bb260ef49c9646bb47 /src/or
parent5965b3849ed6910122c00ab008c3a3f5fa79d6fa (diff)
downloadtor-713c995adb3fcbdb3a05ac61b2e46f205432dce2.tar.gz
tor-713c995adb3fcbdb3a05ac61b2e46f205432dce2.zip
Do not mark directories as down simply because they dont have the router descs we want.
svn:r5595
Diffstat (limited to 'src/or')
-rw-r--r--src/or/directory.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index db4e0f0649..249d05376b 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -818,9 +818,9 @@ body_is_plausible(const char *body, size_t len, int purpose)
/** We are a client, and we've finished reading the server's
* response. Parse and it and act appropriately.
*
- * If we're happy with the result (we get it and it's useful),
- * return 0. Otherwise return -1, and the caller should consider
- * trying the request again.
+ * If we're still happy with using this directory server in the future, return
+ * 0. Otherwise return -1; and the caller should consider trying the request
+ * again.
*
* The caller will take care of marking the connection for close.
*/
@@ -1041,11 +1041,11 @@ connection_dir_client_reached_eof(connection_t *conn)
n_asked_for = smartlist_len(which);
}
if (status_code != 200) {
- int no_warn = status_code == 404 ||
- (status_code == 400 && !strcmp(reason, "Servers unavailable."));
+ int dir_okay = status_code == 404 ||
+ (status_code == 400 && strcmp(reason, "Servers unavailable."));
/* 404 means that it didn't have them; no big deal.
* Older (pre-0.1.1.8) servers said 400 Servers unavailable instead. */
- log_fn(no_warn ? LOG_INFO : LOG_WARN, LD_DIR,
+ log_fn(dir_okay ? LOG_INFO : LOG_WARN, LD_DIR,
"Received http status code %d (\"%s\") from server '%s:%d' "
"while fetching \"/tor/server/%s\". I'll try again soon.",
status_code, reason, conn->address, conn->port,
@@ -1058,7 +1058,7 @@ connection_dir_client_reached_eof(connection_t *conn)
smartlist_free(which);
}
tor_free(body); tor_free(headers); tor_free(reason);
- return -1;
+ return dir_okay ? 0 : -1;
}
/* Learn the routers, assuming we requested by fingerprint or "all".
* Right now, we only use "authority" to fetch ourself, so we don't want
@@ -1182,15 +1182,6 @@ connection_dir_reached_eof(connection_t *conn)
int retval;
if (conn->state != DIR_CONN_STATE_CLIENT_READING) {
info(LD_HTTP,"conn reached eof, not reading. Closing.");
- /* This check is temporary; it's to let us know whether we should consider
- * parsing partial serverdesc responses. */
- if (conn->purpose == DIR_PURPOSE_FETCH_SERVERDESC &&
- buf_datalen(conn->inbuf)>=(24*1024)) {
- notice(LD_DIR,
- "Directory connection closed early after downloading %d bytes of "
- "descriptors. If this happens often, please file a bug report.",
- (int)buf_datalen(conn->inbuf));
- }
connection_close_immediate(conn); /* error: give up on flushing */
connection_mark_for_close(conn);
return -1;