[or-cvs] subtle change to avoid some false positives:

arma at seul.org arma at seul.org
Thu Sep 1 08:13:42 UTC 2005


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

Modified Files:
	dirserv.c or.h routerlist.c 
Log Message:
subtle change to avoid some false positives:
if a server went down for six hours and then came back, we would
complain to it that it's unreachable. now we wait until the third
consecutive descriptor post that we thought it was unreachable,
before complaining to it.


Index: dirserv.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/dirserv.c,v
retrieving revision 1.202
retrieving revision 1.203
diff -u -d -r1.202 -r1.203
--- dirserv.c	31 Aug 2005 06:14:37 -0000	1.202
+++ dirserv.c	1 Sep 2005 08:13:40 -0000	1.203
@@ -1290,6 +1290,7 @@
     } else { /* correct nickname and digest. mark this router reachable! */
       log_fn(LOG_INFO,"Found router %s to be reachable. Yay.", ri->nickname);
       ri->last_reachable = time(NULL);
+      ri->num_unreachable_notifications = 0;
     }
   }
 }

Index: or.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.662
retrieving revision 1.663
diff -u -d -r1.662 -r1.663
--- or.h	31 Aug 2005 06:14:37 -0000	1.662
+++ or.h	1 Sep 2005 08:13:40 -0000	1.663
@@ -750,8 +750,13 @@
 
   /* The below items are used only by authdirservers for
    * reachability testing. */
-  time_t last_reachable; /**< When was the last time we could reach this OR? */
-  time_t testing_since; /**< When did we start testing reachability for this OR? */
+  /** When was the last time we could reach this OR? */
+  time_t last_reachable;
+  /** When did we start testing reachability for this OR? */
+  time_t testing_since;
+  /** How many times has a descriptor been posted and we believed
+   * this router to be unreachable? We only actually warn on the third. */
+  int num_unreachable_notifications;
 } routerinfo_t;
 
 /** Contents of a running-routers list */

Index: routerlist.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.263
retrieving revision 1.264
diff -u -d -r1.263 -r1.264
--- routerlist.c	31 Aug 2005 06:18:19 -0000	1.263
+++ routerlist.c	1 Sep 2005 08:13:40 -0000	1.264
@@ -912,7 +912,7 @@
         *msg = "Router descriptor was not new.";
         return -1;
       } else {
-        int unreachable;
+        int unreachable = 0;
         log_fn(LOG_DEBUG, "Replacing entry for router '%s/%s' [%s]",
                router->nickname, old_router->nickname,
                hex_str(id_digest,DIGEST_LEN));
@@ -921,13 +921,20 @@
           /* these carry over when the address and orport are unchanged.*/
           router->last_reachable = old_router->last_reachable;
           router->testing_since = old_router->testing_since;
+          router->num_unreachable_notifications =
+             old_router->num_unreachable_notifications;
         }
-        unreachable = authdir &&
-          dirserv_thinks_router_is_blatantly_unreachable(router, time(NULL));
-        if (unreachable) {
-          log_fn(LOG_WARN, "Notifying server '%s' that it's unreachable. (ContactInfo '%s', platform '%s').",
-           router->nickname, router->contact_info ? router->contact_info : "",
-           router->platform ? router->platform : "");
+        if (authdir &&
+            dirserv_thinks_router_is_blatantly_unreachable(router, time(NULL))) {
+          if (router->num_unreachable_notifications >= 3) {
+            unreachable = 1;
+            log_fn(LOG_WARN, "Notifying server '%s' that it's unreachable. (ContactInfo '%s', platform '%s').",
+              router->nickname, router->contact_info ? router->contact_info : "",
+              router->platform ? router->platform : "");
+          } else {
+            log_fn(LOG_NOTICE,"'%s' may be unreachable -- the %d previous descriptors were thought to be unreachable.", router->nickname, router->num_unreachable_notifications);
+            router->num_unreachable_notifications++;
+          }
         }
         routerinfo_free(old_router);
         smartlist_set(routerlist->routers, i, router);



More information about the tor-commits mailing list