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

[or-cvs] Log even less verbosely. Also, do not download old (freque...



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

Modified Files:
	directory.c routerlist.c 
Log Message:
Log even less verbosely.  Also, do not download old (frequently-updating) servers more than once every 2 hours.

Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/directory.c,v
retrieving revision 1.289
retrieving revision 1.290
diff -u -d -r1.289 -r1.290
--- directory.c	23 Sep 2005 18:05:13 -0000	1.289
+++ directory.c	23 Sep 2005 21:25:29 -0000	1.290
@@ -981,7 +981,9 @@
       n_asked_for = smartlist_len(which);
     }
     if (status_code != 200) {
-      log_fn(LOG_WARN,"Received http status code %d (\"%s\") from server '%s:%d' while fetching \"/tor/server/%s\". I'll try again soon.",
+      /* 404 means that it didn't have them; no big deal. */
+      log_fn(status_code == 404 ? LOG_INFO : LOG_WARN,
+             "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,
              conn->requested_resource);
       tor_free(body); tor_free(headers); tor_free(reason);
@@ -1283,7 +1285,7 @@
     dirserv_get_routerdescs(descs, url);
     tor_free(url);
     if (!smartlist_len(descs)) {
-      write_http_status_line(conn, 400, "Servers unavailable.");
+      write_http_status_line(conn, 404, "Servers unavailable.");
     } else {
       size_t len = 0;
       format_rfc1123_time(date, time(NULL));
@@ -1588,13 +1590,13 @@
       }
     }
     if (rs->next_attempt_at == 0)
-      log_fn(LOG_NOTICE, "%s failed %d time(s); I'll try again immediately.",
+      log_fn(LOG_INFO, "%s failed %d time(s); I'll try again immediately.",
              cp, (int)rs->n_download_failures);
     else if (rs->next_attempt_at < TIME_MAX)
-      log_fn(LOG_NOTICE, "%s failed %d time(s); I'll try again in %d seconds.",
+      log_fn(LOG_INFO, "%s failed %d time(s); I'll try again in %d seconds.",
              cp, (int)rs->n_download_failures, (int)(rs->next_attempt_at-now));
     else
-      log_fn(LOG_NOTICE, "%s failed %d time(s); Giving up for a while.",
+      log_fn(LOG_INFO, "%s failed %d time(s); Giving up for a while.",
              cp, (int)rs->n_download_failures);
   });
 

Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.314
retrieving revision 1.315
diff -u -d -r1.314 -r1.315
--- routerlist.c	23 Sep 2005 20:31:07 -0000	1.314
+++ routerlist.c	23 Sep 2005 21:25:29 -0000	1.315
@@ -2349,7 +2349,9 @@
 static smartlist_t *
 router_list_downloadable(void)
 {
+#define MAX_OLD_SERVER_DOWNLOAD_RATE 2*60*60
   int n_conns, i, n_downloadable = 0;
+  int n_uptodate=0,n_skip_old=0;
   connection_t **carray;
   smartlist_t *superseded = smartlist_create();
   smartlist_t *downloading;
@@ -2424,12 +2426,22 @@
         continue;
       }
       /* Change this "or" to be an "and" once dirs generate hashes right.
+       * Remove the version check once older versions are uncommon.
        * XXXXX. NM */
       if (!memcmp(ri->signed_descriptor_digest, rs->status.descriptor_digest,
                   DIGEST_LEN) ||
           rs->status.published_on <= ri->published_on) {
-        /* Same digest, or earlier. No need to download it. */
+        ++n_uptodate;
+        rs->should_download = 0;
+        --n_downloadable;
+      } else if (ri->platform &&
+                 !tor_version_as_new_as(ri->platform, "0.1.1.6-alpha") &&
+                 ri->published_on + MAX_OLD_SERVER_DOWNLOAD_RATE > now)  {
+        /* Same digest, or date is up-to-date, or we have a comparatively recent
+         * server with an old version.
+         * No need to download it. */
         // log_fn(LOG_NOTICE, "Up-to-date status for %s", fp);
+        ++n_skip_old;
         rs->should_download = 0;
         --n_downloadable;
       } /* else {
@@ -2447,6 +2459,9 @@
     });
   }
 
+  if (n_skip_old)
+    log_fn(LOG_INFO, "Skipped %d updatable pre-0.1.1.6 servers.", n_skip_old);
+
   if (!n_downloadable)
     return superseded;
 
@@ -2479,7 +2494,6 @@
   smartlist_t *downloadable = NULL;
   int get_all = 0;
   int always_split = !server_mode(get_options()) || !get_options()->DirPort;
-
   if (!networkstatus_list || smartlist_len(networkstatus_list)<2)
     get_all = 1;
 
@@ -2519,8 +2533,6 @@
       directory_get_from_dirserver(DIR_PURPOSE_FETCH_SERVERDESC,resource,1);
     }
     tor_free(resource);
-  } else {
-    log_fn(LOG_NOTICE, "No routers to download.");
   }
   SMARTLIST_FOREACH(downloadable, char *, c, tor_free(c));
   smartlist_free(downloadable);