diff options
author | George Kadianakis <desnacked@riseup.net> | 2017-03-27 15:08:18 +0200 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-03-27 15:39:26 +0200 |
commit | ef4c10fb42e796a7a1662b5f1db27d10347e89af (patch) | |
tree | 4c21e02f8607921531fa3ca39bab7a674ba0dca8 /src | |
parent | a5130de43297373ec93c3623689e42cc1384b3f9 (diff) | |
download | tor-ef4c10fb42e796a7a1662b5f1db27d10347e89af.tar.gz tor-ef4c10fb42e796a7a1662b5f1db27d10347e89af.zip |
Fix max sampled size logic when in bridge mode.
When calculating max sampled size, Tor would only count the number of
bridges in torrc, without considering that our state file might already
have sampled bridges in it. This caused problems when people swap
bridges, since the following error would trigger:
[warn] Not expanding the guard sample any further; just hit the
maximum sample threshold of 1
Diffstat (limited to 'src')
-rw-r--r-- | src/or/entrynodes.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c index c3c576c812..e0a3854b74 100644 --- a/src/or/entrynodes.c +++ b/src/or/entrynodes.c @@ -989,9 +989,11 @@ get_max_sample_size(guard_selection_t *gs, const int using_bridges = (gs->type == GS_TYPE_BRIDGE); const int min_sample = get_min_filtered_sample_size(); - /* With bridges, max_sample is "all of them" */ + /* If we are in bridge mode, expand our sample set as needed without worrying + * about max size. We should respect the user's wishes to use many bridges if + * that's what they have specified in their configuration file. */ if (using_bridges) - return n_guards; + return INT_MAX; const int max_sample_by_pct = (int)(n_guards * get_max_sample_threshold()); const int max_sample_absolute = get_max_sample_size_absolute(); |