[or-cvs] Downgrade noisy log messages in preparation for an alpha re...

Nick Mathewson nickm at seul.org
Wed Oct 5 01:27:10 UTC 2005


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

Modified Files:
	directory.c routerlist.c 
Log Message:
Downgrade noisy log messages in preparation for an alpha release.

Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/directory.c,v
retrieving revision 1.300
retrieving revision 1.301
diff -u -d -r1.300 -r1.301
--- directory.c	5 Oct 2005 00:22:55 -0000	1.300
+++ directory.c	5 Oct 2005 01:27:08 -0000	1.301
@@ -993,8 +993,11 @@
       n_asked_for = smartlist_len(which);
     }
     if (status_code != 200) {
-      /* 404 means that it didn't have them; no big deal. */
-      log_fn(status_code == 404 ? LOG_INFO : LOG_WARN,
+      int no_warn = 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,
              "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);
@@ -1020,8 +1023,9 @@
       directory_info_has_arrived(time(NULL), 0);
     }
     if (which) { /* mark remaining ones as failed */
-      log_fn(LOG_NOTICE, "Received %d/%d routers.",
-             n_asked_for-smartlist_len(which), n_asked_for);
+      log_fn(LOG_INFO, "Received %d/%d routers requested from %s:%d",
+             n_asked_for-smartlist_len(which), n_asked_for,
+             conn->address, (int)conn->port);
       if (smartlist_len(which)) {
         dir_routerdesc_download_failed(which);
       }

Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.325
retrieving revision 1.326
diff -u -d -r1.325 -r1.326
--- routerlist.c	4 Oct 2005 22:23:31 -0000	1.325
+++ routerlist.c	5 Oct 2005 01:27:08 -0000	1.326
@@ -1257,7 +1257,7 @@
         log_fn(LOG_DEBUG, "Skipping unverified entry for verified router '%s'",
                router->nickname);
         routerinfo_free(router);
-        *msg = "Already have verified router with same nickname and different key.";
+        *msg = "Already have named router with same nickname and different key.";
         return -2;
       }
     }
@@ -1313,6 +1313,7 @@
 {
   routerinfo_t *ri;
   tor_assert(msg);
+  smartlist_t *lst;
   *msg = NULL;
 
   if (!(ri = router_parse_entry_from_string(s, NULL))) {
@@ -1326,22 +1327,23 @@
     routerinfo_free(ri);
     return 0;
   }
-  /* XXXX011 update router status from networkstatus!! */
+
+  lst = smartlist_create();
+  smartlist_add(lst, ri);
+  routers_update_status_from_networkstatus(lst, 0);
 
   if (router_add_to_routerlist(ri, msg, 0)<0) {
     log_fn(LOG_WARN, "Couldn't add router to list: %s Dropping.",
            *msg?*msg:"(No message).");
     /* we've already assigned to *msg now, and ri is already freed */
+    smartlist_free(lst);
     return 0;
   } else {
-    smartlist_t *changed = smartlist_create();
-    smartlist_add(changed, ri);
-    control_event_descriptors_changed(changed);
-    smartlist_free(changed);
+    control_event_descriptors_changed(lst);
+    smartlist_free(lst);
+    log_fn(LOG_DEBUG, "Added router to list");
+    return 1;
   }
-
-  log_fn(LOG_DEBUG, "Added router to list");
-  return 1;
 }
 
 /** Given a string <b>s</b> containing some routerdescs, parse it and put the
@@ -1513,8 +1515,9 @@
                   ns->networkstatus_digest, DIGEST_LEN)) {
         /* Same one we had before. */
         networkstatus_free(ns);
-        log_fn(LOG_NOTICE,
-            "Dropping network-status from %s (published %s); already have it.",
+        log_fn(LOG_INFO,
+               "Not replacing network-status from %s (published %s); "
+               "we already have it.",
                trusted_dir->description, published);
         if (old_ns->received_on < arrived_at) {
           if (source != NS_FROM_CACHE) {
@@ -1529,8 +1532,8 @@
       } else if (old_ns->published_on >= ns->published_on) {
         char old_published[ISO_TIME_LEN+1];
         format_iso_time(old_published, old_ns->published_on);
-        log_fn(LOG_NOTICE,
-               "Dropping network-status from %s (published %s);"
+        log_fn(LOG_INFO,
+               "Not replacing network-status from %s (published %s);"
                " we have a newer one (published %s) for this authority.",
                trusted_dir->description, published,
                old_published);
@@ -1548,8 +1551,7 @@
   if (!found)
     smartlist_add(networkstatus_list, ns);
 
-  /*XXXX011 downgrade to INFO NM */
-  log_fn(LOG_NOTICE, "Setting networkstatus %s %s (published %s)",
+  log_fn(LOG_INFO, "Setting networkstatus %s %s (published %s)",
          source == NS_FROM_CACHE?"cached from":
          (source==NS_FROM_DIR?"downloaded from":"generated for"),
          trusted_dir->description, published);
@@ -1750,15 +1752,14 @@
     needed = n_running_dirservers;
 
   if (needed)
-    /* XXXX011 Downgrade to info NM */
-    log_fn(LOG_NOTICE, "For %d/%d running directory servers, we have %d live"
+    log_fn(LOG_INFO, "For %d/%d running directory servers, we have %d live"
            " network-status documents. Downloading %d.",
            n_running_dirservers, n_dirservers, n_live, needed);
 
   /* Also, download at least 1 every NETWORKSTATUS_CLIENT_DL_INTERVAL. */
   if (n_running_dirservers &&
       most_recent_received < now-NETWORKSTATUS_CLIENT_DL_INTERVAL && needed < 1) {
-    log_fn(LOG_NOTICE, "Our most recent network-status document (from %s) "
+    log_fn(LOG_INFO, "Our most recent network-status document (from %s) "
            "is %d seconds old; downloading another.",
            most_recent?most_recent->description:"nobody",
            (int)(now-most_recent_received));
@@ -2198,7 +2199,7 @@
         ns->published_on + DEFAULT_RUNNING_INTERVAL > now) {
       if (!ns->is_recent) {
         format_iso_time(published, ns->published_on);
-        log_fn(LOG_NOTICE,
+        log_fn(LOG_INFO,
                "Networkstatus from %s (published %s) is now \"recent\"",
                src, published);
         changed = 1;
@@ -2208,7 +2209,7 @@
     } else {
       if (ns->is_recent) {
         format_iso_time(published, ns->published_on);
-        log_fn(LOG_NOTICE,
+        log_fn(LOG_INFO,
                "Networkstatus from %s (published %s) is no longer \"recent\"",
                src, published);
         changed = 1;
@@ -2258,7 +2259,7 @@
     return;
   }
 
-  log_fn(LOG_NOTICE, "rebuilding router status list.");
+  log_fn(LOG_INFO, "Rebuilding router status list.");
 
   index = tor_malloc(sizeof(int)*n_statuses);
   size = tor_malloc(sizeof(int)*n_statuses);
@@ -2647,7 +2648,7 @@
       if (n_per_request < MIN_DL_PER_REQUEST)
         n_per_request = MIN_DL_PER_REQUEST;
     }
-    log_fn(LOG_NOTICE, "Launching %d request%s for %d router%s, %d at a time",
+    log_fn(LOG_INFO, "Launching %d request%s for %d router%s, %d at a time",
            (n_downloadable+n_per_request-1)/n_per_request,
            n_downloadable>n_per_request?"s":"",
            n_downloadable, n_downloadable>1?"s":"", n_per_request);



More information about the tor-commits mailing list