summaryrefslogtreecommitdiff
path: root/src/common/container.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-11-08 16:58:59 +0000
committerNick Mathewson <nickm@torproject.org>2007-11-08 16:58:59 +0000
commite0b9c893bc4e60cb3e6d8aa65d49a2a4ba2b6260 (patch)
tree5394c35c788ee05f37bfb75fc5feca7c12dbd11a /src/common/container.h
parent46273c908020144d683365b956bfa9950b815296 (diff)
downloadtor-e0b9c893bc4e60cb3e6d8aa65d49a2a4ba2b6260.tar.gz
tor-e0b9c893bc4e60cb3e6d8aa65d49a2a4ba2b6260.zip
r16573@catbus: nickm | 2007-11-08 11:57:16 -0500
Mess with the formula for the Guard flag again. Now it requires that you be in the most familiar 7/8 of nodes, and have above median wfu for that 7/8th. See spec for details. Also, log thresholds better. svn:r12440
Diffstat (limited to 'src/common/container.h')
-rw-r--r--src/common/container.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/common/container.h b/src/common/container.h
index bbf654f5f2..6e1e1801c4 100644
--- a/src/common/container.h
+++ b/src/common/container.h
@@ -322,6 +322,7 @@ int find_nth_int(int *array, int n_elements, int nth);
time_t find_nth_time(time_t *array, int n_elements, int nth);
double find_nth_double(double *array, int n_elements, int nth);
uint32_t find_nth_uint32(uint32_t *array, int n_elements, int nth);
+long find_nth_long(long *array, int n_elements, int nth);
static INLINE int
median_int(int *array, int n_elements)
{
@@ -342,6 +343,11 @@ median_uint32(uint32_t *array, int n_elements)
{
return find_nth_uint32(array, n_elements, (n_elements-1)/2);
}
+static INLINE long
+median_long(long *array, int n_elements)
+{
+ return find_nth_long(array, n_elements, (n_elements-1)/2);
+}
#endif