[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Do not mark directories as down simply because they dont ha...



Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv24583/src/or

Modified Files:
	directory.c 
Log Message:
Do not mark directories as down simply because they dont have the router descs we want.

Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/directory.c,v
retrieving revision 1.327
retrieving revision 1.328
diff -u -d -r1.327 -r1.328
--- directory.c	15 Dec 2005 20:44:15 -0000	1.327
+++ directory.c	15 Dec 2005 21:15:16 -0000	1.328
@@ -818,9 +818,9 @@
 /** 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 @@
       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 @@
         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 @@
   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;