diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-11-29 14:47:39 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-12-16 11:06:20 -0500 |
commit | 9d065ecc3d9e1a34c35be2d3531696798f6ecd3e (patch) | |
tree | d026b55984f1519c16f0d89ef84082769bda8523 /src | |
parent | 1e9cd5d2bbbf54818da6b6585bb60298712e6f06 (diff) | |
download | tor-9d065ecc3d9e1a34c35be2d3531696798f6ecd3e.tar.gz tor-9d065ecc3d9e1a34c35be2d3531696798f6ecd3e.zip |
Fix a magic number in get_max_sample_size
Diffstat (limited to 'src')
-rw-r--r-- | src/or/entrynodes.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c index c624c64b3f..9630f170f1 100644 --- a/src/or/entrynodes.c +++ b/src/or/entrynodes.c @@ -898,14 +898,17 @@ get_max_sample_size(guard_selection_t *gs, int n_guards) { const int using_bridges = (gs->type == GS_TYPE_BRIDGE); + const int min_sample = get_min_filtered_sample_size(); /* XXXX prop271 spec deviation with bridges, max_sample is "all of them" */ if (using_bridges) return n_guards; - else if (n_guards < 20) // XXXX prop271 spec deviation - return n_guards; + + const int max_sample = (int)(n_guards * get_max_sample_threshold()); + if (max_sample < min_sample) // XXXX prop271 spec deviation + return min_sample; else - return (int)(n_guards * get_max_sample_threshold()); + return max_sample; } /** |