[or-cvs] r9614: patch from mwenge: rate-limit newnym. (in tor/trunk: . doc src/or)

nickm at seul.org nickm at seul.org
Thu Feb 22 06:21:17 UTC 2007


Author: nickm
Date: 2007-02-22 01:21:16 -0500 (Thu, 22 Feb 2007)
New Revision: 9614

Modified:
   tor/trunk/
   tor/trunk/doc/TODO
   tor/trunk/src/or/main.c
Log:
 r11872 at catbus:  nickm | 2007-02-22 01:08:46 -0500
 patch from mwenge: rate-limit newnym.



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

Modified: tor/trunk/doc/TODO
===================================================================
--- tor/trunk/doc/TODO	2007-02-21 08:54:12 UTC (rev 9613)
+++ tor/trunk/doc/TODO	2007-02-22 06:21:16 UTC (rev 9614)
@@ -334,7 +334,7 @@
     https thing in the default configuration:
     http://wiki.noreply.org/noreply/TheOnionRouter/TorFAQ#PrivoxyWeirdSSLPort
   . Flesh out options_description array in src/or/config.c
-  - Don't let 'newnym' be triggered more often than every n seconds.
+  . Don't let 'newnym' be triggered more often than every n seconds.
   X If we try to publish as a nickname that's already claimed, should
     we append a number (or increment the number) and try again? This
     way people who read their logs can fix it as before, but people

Modified: tor/trunk/src/or/main.c
===================================================================
--- tor/trunk/src/or/main.c	2007-02-21 08:54:12 UTC (rev 9613)
+++ tor/trunk/src/or/main.c	2007-02-22 06:21:16 UTC (rev 9614)
@@ -54,6 +54,8 @@
 static time_t time_to_fetch_running_routers = 0;
 /** When do we next launch DNS wildcarding checks? */
 static time_t time_to_check_for_correct_dns = 0;
+/** When do we next allow a SIGNEWNYM? */
+static time_t time_to_allow_next_signewnym = 0;
 
 /** Array of all open connections.  The first n_conns elements are valid. */
 static connection_t *connection_array[MAXCONNECTIONS+1] =
@@ -1328,6 +1330,7 @@
   uintptr_t sig = (uintptr_t)arg;
   (void)fd;
   (void)events;
+  time_t now = time(NULL);
   switch (sig)
     {
     case SIGTERM:
@@ -1371,8 +1374,12 @@
       break;
 #endif
     case SIGNEWNYM:
-      circuit_expire_all_dirty_circs();
-      addressmap_clear_transient();
+      if (time_to_allow_next_signewnym < now) {
+        circuit_expire_all_dirty_circs();
+        addressmap_clear_transient();
+#define NEXT_SIGNEWNYM (5)
+        time_to_allow_next_signewnym = now + NEXT_SIGNEWNYM;
+      }
       break;
     case SIGCLEARDNSCACHE:
       addressmap_clear_transient();



More information about the tor-commits mailing list