aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-10-28 23:44:57 +0000
committerNick Mathewson <nickm@torproject.org>2007-10-28 23:44:57 +0000
commit30e73f3a5e7e9e069e15425d1d2d8171b91b9a3d (patch)
tree355478f4709c8cc85f203e223645e84a34649c74 /src
parent5f8bd6e6a48af0eddeb878feba11dec70d090db6 (diff)
downloadtor-30e73f3a5e7e9e069e15425d1d2d8171b91b9a3d.tar
tor-30e73f3a5e7e9e069e15425d1d2d8171b91b9a3d.tar.gz
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). svn:r12261
Diffstat (limited to 'src')
-rw-r--r--src/or/rephist.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 19377369d..98d02d90d 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -384,6 +384,9 @@ get_stability(or_history_t *hist, time_t when)
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 @@ get_weighted_fractional_uptime(or_history_t *hist, time_t when)
} 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;
}