[or-cvs] even better, only print extend attempts if there are any.

Roger Dingledine arma at seul.org
Wed Aug 18 09:57:52 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	rephist.c 
Log Message:
even better, only print extend attempts if there are any.


Index: rephist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rephist.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- rephist.c	18 Aug 2004 09:49:17 -0000	1.27
+++ rephist.c	18 Aug 2004 09:57:50 -0000	1.28
@@ -266,30 +266,29 @@
         or_history->n_conn_ok, or_history->n_conn_fail+or_history->n_conn_ok,
         upt, upt+downt, uptime*100.0);
 
-    if (!strmap_isempty(or_history->link_history_map))
+    if (!strmap_isempty(or_history->link_history_map)) {
       strcpy(buffer, "    Good extend attempts: ");
-    else
-      *buffer = '\0';
-    len = strlen(buffer);
-    for (lhist_it = strmap_iter_init(or_history->link_history_map);
-         !strmap_iter_done(lhist_it);
-         lhist_it = strmap_iter_next(or_history->link_history_map, lhist_it)) {
-      strmap_iter_get(lhist_it, &hexdigest2, &link_history_p);
-      if ((r = router_get_by_hexdigest(hexdigest2)))
-        name2 = r->nickname;
-      else
-        name2 = "(unknown)";
+      len = strlen(buffer);
+      for (lhist_it = strmap_iter_init(or_history->link_history_map);
+           !strmap_iter_done(lhist_it);
+           lhist_it = strmap_iter_next(or_history->link_history_map, lhist_it)) {
+        strmap_iter_get(lhist_it, &hexdigest2, &link_history_p);
+        if ((r = router_get_by_hexdigest(hexdigest2)))
+          name2 = r->nickname;
+        else
+          name2 = "(unknown)";
 
-      link_history = (link_history_t*) link_history_p;
-      len += snprintf(buffer+len, 2048-len, "%s(%ld/%ld); ", name2,
-                      link_history->n_extend_ok,
-                      link_history->n_extend_ok+link_history->n_extend_fail);
-      if (len >= 2048) {
-        buffer[2047]='\0';
-        break;
+        link_history = (link_history_t*) link_history_p;
+        len += snprintf(buffer+len, 2048-len, "%s(%ld/%ld); ", name2,
+                        link_history->n_extend_ok,
+                        link_history->n_extend_ok+link_history->n_extend_fail);
+        if (len >= 2048) {
+          buffer[2047]='\0';
+          break;
+        }
       }
+      log(severity, buffer);
     }
-    log(severity, buffer);
   }
 }
 



More information about the tor-commits mailing list