[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r9647: tell the user if we're delaying his newnym request. also, pi (tor/trunk/src/or)



Author: arma
Date: 2007-02-24 16:21:38 -0500 (Sat, 24 Feb 2007)
New Revision: 9647

Modified:
   tor/trunk/src/or/directory.c
   tor/trunk/src/or/main.c
   tor/trunk/src/or/routerlist.c
Log:
tell the user if we're delaying his newnym request. also, pick
a different set of fenceposts.


Modified: tor/trunk/src/or/directory.c
===================================================================
--- tor/trunk/src/or/directory.c	2007-02-24 20:37:24 UTC (rev 9646)
+++ tor/trunk/src/or/directory.c	2007-02-24 21:21:38 UTC (rev 9647)
@@ -352,8 +352,8 @@
   /* No need to increment the failure count for routerdescs, since
    * it's not their fault. */
 
-  /* There's no relaunch descriptor downloads here: we already do it every 10
-   * seconds (DESCRIPTOR_RETRY_INTERVAL) in main.c */
+  /* No need to relaunch descriptor downloads here: we already do it
+   * every 10 seconds (DESCRIPTOR_RETRY_INTERVAL) in main.c. */
 
   (void) conn;
 }
@@ -2057,8 +2057,8 @@
                 cp, (int)rs->n_download_failures);
   });
 
-  /* There's no relaunch descriptor downloads here: we already do it every 10
-   * seconds (DESCRIPTOR_RETRY_INTERVAL) in main.c */
+  /* No need to relaunch descriptor downloads here: we already do it
+   * every 10 seconds (DESCRIPTOR_RETRY_INTERVAL) in main.c. */
 }
 
 /** Given a directory <b>resource</b> request, containing zero

Modified: tor/trunk/src/or/main.c
===================================================================
--- tor/trunk/src/or/main.c	2007-02-24 20:37:24 UTC (rev 9646)
+++ tor/trunk/src/or/main.c	2007-02-24 21:21:38 UTC (rev 9647)
@@ -756,7 +756,8 @@
   /* 0b. If we've deferred a signewnym, make sure it gets handled
    * eventually */
   if (signewnym_is_pending &&
-      time_of_last_signewnym + MAX_SIGNEWNYM_RATE < now) {
+      time_of_last_signewnym + MAX_SIGNEWNYM_RATE <= now) {
+    log(LOG_INFO, LD_CONTROL, "Honoring delayed NEWNYM request");
     circuit_expire_all_dirty_circs();
     addressmap_clear_transient();
     time_of_last_signewnym = now;
@@ -1389,9 +1390,15 @@
 #endif
     case SIGNEWNYM: {
       time_t now = time(NULL);
-      if (time_of_last_signewnym + MAX_SIGNEWNYM_RATE >= now) {
+      if (time_of_last_signewnym + MAX_SIGNEWNYM_RATE > now) {
         signewnym_is_pending = 1;
+        log(LOG_NOTICE, LD_CONTROL,
+            "Rate limiting NEWNYM request: delaying by %d second(s)",
+            (int)(MAX_SIGNEWNYM_RATE+time_of_last_signewnym-now));
       } else {
+        /* XXX refactor someday: these two calls are in
+         * run_scheduled_events() above too, and they should be in just
+         * one place. */
         circuit_expire_all_dirty_circs();
         addressmap_clear_transient();
         time_of_last_signewnym = now;

Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c	2007-02-24 20:37:24 UTC (rev 9646)
+++ tor/trunk/src/or/routerlist.c	2007-02-24 21:21:38 UTC (rev 9647)
@@ -1911,7 +1911,7 @@
 
     if (!signed_desc_digest_is_recognized(&router->cache_info)) {
       /* We asked for it, so some networkstatus must have listed it when we
-       * did.  save it in case we're a cache and somebody else asks for it. */
+       * did.  Save it if we're a cache in case somebody else asks for it. */
       log_info(LD_DIR,
                "Received a no-longer-recognized descriptor for router '%s'",
                router->nickname);