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

[or-cvs] r12261: Do not count a server as having any WFU until we have known (in tor/trunk: . src/or)



Author: nickm
Date: 2007-10-28 19:44:57 -0400 (Sun, 28 Oct 2007)
New Revision: 12261

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/rephist.c
Log:
 r16248@catbus:  nickm | 2007-10-28 19:42:14 -0400
 Do not count a server as having any WFU until we have known about it for 18 hours (weighted).



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

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-10-28 23:44:55 UTC (rev 12260)
+++ tor/trunk/ChangeLog	2007-10-28 23:44:57 UTC (rev 12261)
@@ -23,6 +23,8 @@
     - Directory authorities now decide whether routers are stable enough to
       be guards based not on their MTBF or their uptime, but on their
       fractional uptime: the fraction of the time that they are online.
+      (No router counts as having uptime until we've known about it for
+      at least 24 hours.)
     - Clients new hold circuitless TLS connections open for 1.5 times
       MaxCircuitDirtiness, since it is likely that they'll need to build
       a circuit over them within that timeframe.  Previously, they held them

Modified: tor/trunk/src/or/rephist.c
===================================================================
--- tor/trunk/src/or/rephist.c	2007-10-28 23:44:55 UTC (rev 12260)
+++ tor/trunk/src/or/rephist.c	2007-10-28 23:44:57 UTC (rev 12261)
@@ -384,6 +384,9 @@
   return total / total_weights;
 }
 
+/* Until we've known about you for this long, you simply can't be up. */
+#define MIN_WEIGHTED_TIME_TO_BE_UP (18*60*60)
+
 /** Helper: Return the weighted percent-of-time-online of the router with
  * history <b>hist</b>. */
 static double
@@ -399,6 +402,8 @@
   } else if (hist->start_of_downtime) {
     total += (when - hist->start_of_downtime);
   }
+  if (total < MIN_WEIGHTED_TIME_TO_BE_UP)
+    return 0.0;
   return ((double) up) / total;
 }