[or-cvs] r14069: Only dump all guard node status to the log when the guard no (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Mon Mar 17 04:07:53 UTC 2008


Author: nickm
Date: 2008-03-17 00:07:51 -0400 (Mon, 17 Mar 2008)
New Revision: 14069

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/circuitbuild.c
   tor/trunk/src/or/connection.c
   tor/trunk/src/or/directory.c
Log:
 r18872 at catbus:  nickm | 2008-03-16 23:56:48 -0400
 Only dump all guard node status to the log when the guard node status actually changes.  Downgrade the 4 most common remaining INFO log messages to DEBUG.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r18872] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2008-03-17 03:50:24 UTC (rev 14068)
+++ tor/trunk/ChangeLog	2008-03-17 04:07:51 UTC (rev 14069)
@@ -38,6 +38,9 @@
     - Add a malloc_good_size implementation to OpenBSD_malloc_linux.c,
       to avoid unused RAM in buffer chunks and memory pools.
     - Downgrade "sslv3 alert handshake failure" message to INFO.
+    - Only log guard node status when guard node status has changed.
+    - Downgrade the 3 most common "INFO" messages to "DEBUG".  This will make
+      "INFO" 75% less verbose.
 
   o Code simplifications and refactoring:
     - Refactor code using connection_ap_handshake_attach_circuit() to

Modified: tor/trunk/src/or/circuitbuild.c
===================================================================
--- tor/trunk/src/or/circuitbuild.c	2008-03-17 03:50:24 UTC (rev 14068)
+++ tor/trunk/src/or/circuitbuild.c	2008-03-17 04:07:51 UTC (rev 14069)
@@ -755,8 +755,8 @@
     char tmpbuf[INET_NTOA_BUF_LEN];
     in.s_addr = htonl(circ->n_addr);
     tor_inet_ntoa(&in,tmpbuf,sizeof(tmpbuf));
-    log_info(LD_CIRC|LD_OR,"Next router (%s:%d) not connected. Connecting.",
-             tmpbuf, circ->n_port);
+    log_debug(LD_CIRC|LD_OR,"Next router (%s:%d) not connected. Connecting.",
+              tmpbuf, circ->n_port);
 
     circ->n_conn_onionskin = tor_malloc(ONIONSKIN_CHALLENGE_LEN);
     memcpy(circ->n_conn_onionskin, onionskin, ONIONSKIN_CHALLENGE_LEN);
@@ -2169,8 +2169,9 @@
 {
   time_t now;
   int changed = 0;
-  int severity = LOG_INFO;
+  int severity = LOG_DEBUG;
   or_options_t *options;
+  const char **reasons;
   if (! entry_guards)
     return;
 
@@ -2178,6 +2179,7 @@
 
   now = time(NULL);
 
+  reasons = tor_malloc_zero(smartlist_len(entry_guards) * sizeof(char*));
   SMARTLIST_FOREACH(entry_guards, entry_guard_t *, entry,
     {
       routerinfo_t *r = router_get_by_digest(entry->identity);
@@ -2187,24 +2189,28 @@
 
       if (entry->bad_since)
         tor_assert(reason);
-
-      log_info(LD_CIRC, "Summary: Entry '%s' is %s, %s%s, and %s.",
-               entry->nickname,
-               entry->unreachable_since ? "unreachable" : "reachable",
-               entry->bad_since ? "unusable: " : "usable",
-               entry->bad_since ? reason : "",
-               entry_is_live(entry, 0, 1, 0) ? "live" : "not live");
+      reasons[entry_sl_idx] = reason;
     });
 
   if (remove_dead_entry_guards())
     changed = 1;
 
+  severity = changed ? LOG_DEBUG : LOG_INFO;
+
   if (changed) {
-    log_fn(severity, LD_CIRC, "    (%d/%d entry guards are usable/new)",
-           num_live_entry_guards(), smartlist_len(entry_guards));
+    SMARTLIST_FOREACH(entry_guards, entry_guard_t *, entry,
+        log_info(LD_CIRC, "Summary: Entry '%s' is %s, %s%s, and %s.",
+               entry->nickname,
+               entry->unreachable_since ? "unreachable" : "reachable",
+               entry->bad_since ? "unusable: " : "usable",
+               reasons[entry_sl_idx] ? reasons[entry_sl_idx] : "",
+               entry_is_live(entry, 0, 1, 0) ? "live" : "not live"));
+    log_info(LD_CIRC, "    (%d/%d entry guards are usable/new)",
+             num_live_entry_guards(), smartlist_len(entry_guards));
     log_entry_guards(LOG_INFO);
     entry_guards_changed();
   }
+  tor_free(reasons);
 }
 
 /** Called when a connection to an OR with the identity digest <b>digest</b>

Modified: tor/trunk/src/or/connection.c
===================================================================
--- tor/trunk/src/or/connection.c	2008-03-17 03:50:24 UTC (rev 14068)
+++ tor/trunk/src/or/connection.c	2008-03-17 04:07:51 UTC (rev 14069)
@@ -1965,14 +1965,14 @@
     switch (result) {
       case TOR_TLS_CLOSE:
       case TOR_TLS_ERROR_IO:
-        log_info(LD_NET,"TLS connection closed %son read. Closing. "
+        log_debug(LD_NET,"TLS connection closed %son read. Closing. "
                  "(Nickname %s, address %s",
                  result == TOR_TLS_CLOSE ? "cleanly " : "",
                  or_conn->nickname ? or_conn->nickname : "not set",
                  conn->address);
         return result;
       CASE_TOR_TLS_ERROR_ANY_NONIO:
-        log_info(LD_NET,"tls error [%s]. breaking (nickname %s, address %s).",
+        log_debug(LD_NET,"tls error [%s]. breaking (nickname %s, address %s).",
                  tor_tls_err_to_string(result),
                  or_conn->nickname ? or_conn->nickname : "not set",
                  conn->address);

Modified: tor/trunk/src/or/directory.c
===================================================================
--- tor/trunk/src/or/directory.c	2008-03-17 03:50:24 UTC (rev 14068)
+++ tor/trunk/src/or/directory.c	2008-03-17 04:07:51 UTC (rev 14069)
@@ -2209,7 +2209,7 @@
     dlen = compressed ? d->dir_z_len : d->dir_len;
 
     if (global_write_bucket_low(TO_CONN(conn), dlen, 1)) {
-      log_info(LD_DIRSERV,
+      log_debug(LD_DIRSERV,
                "Client asked for the mirrored directory, but we've been "
                "writing too many bytes lately. Sending 503 Dir busy.");
       write_http_status_line(conn, 503, "Directory busy, try again later");
@@ -2314,7 +2314,7 @@
 
     dlen = dirserv_estimate_data_size(dir_fps, 0, compressed);
     if (global_write_bucket_low(TO_CONN(conn), dlen, 2)) {
-      log_info(LD_DIRSERV,
+      log_debug(LD_DIRSERV,
                "Client asked for network status lists, but we've been "
                "writing too many bytes lately. Sending 503 Dir busy.");
       write_http_status_line(conn, 503, "Directory busy, try again later");



More information about the tor-commits mailing list