[or-cvs] when removing dead helpers, only write or_state to disk onc...

arma at seul.org arma at seul.org
Sun Dec 11 11:56:19 UTC 2005


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

Modified Files:
	circuitbuild.c 
Log Message:
when removing dead helpers, only write or_state to disk once at the
end, not for every helper you remove.


Index: circuitbuild.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/circuitbuild.c,v
retrieving revision 1.177
retrieving revision 1.178
diff -u -d -r1.177 -r1.178
--- circuitbuild.c	11 Dec 2005 11:23:36 -0000	1.177
+++ circuitbuild.c	11 Dec 2005 11:56:17 -0000	1.178
@@ -1746,6 +1746,7 @@
   char tbuf[ISO_TIME_LEN+1];
   time_t now = time(NULL);
   int i;
+  int changed = 0;
 
   for (i = 0; i < smartlist_len(helper_nodes); ) {
     helper_node_t *helper = smartlist_get(helper_nodes, i);
@@ -1767,10 +1768,11 @@
            helper->nickname, dbuf, why, tbuf);
       tor_free(helper);
       smartlist_del(helper_nodes, i);
-      helper_nodes_changed();
     } else
       ++i;
   }
+  if (changed)
+    helper_nodes_changed();
 }
 
 /** A new directory or router-status has arrived; update the down/listed status
@@ -1860,11 +1862,11 @@
       if (!memcmp(helper->identity, digest, DIGEST_LEN)) {
         if (succeeded) {
           if (helper->down_since) {
-            /*XXXX shouldn't warn. NM */
-            warn(LD_CIRC,
-                 "Connection to formerly down helper node '%s' succeeded. "
-                 "%d/%d helpers usable.", helper->nickname,
-                 num_live_helpers(), smartlist_len(helper_nodes));
+            /*XXXX shouldn't be so loud. NM */
+            notice(LD_CIRC,
+                   "Connection to formerly down helper node '%s' succeeded. "
+                   "%d/%d helpers usable.", helper->nickname,
+                   num_live_helpers(), smartlist_len(helper_nodes));
             helper_nodes_changed();
           }
           helper->down_since = 0;



More information about the tor-commits mailing list