diff options
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/config.c | 2 | ||||
-rw-r--r-- | src/or/geoip.c | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/or/config.c b/src/or/config.c index e462b3e76a..70ad1b55cd 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -1331,7 +1331,7 @@ options_act(or_options_t *old_options) if (! bool_eq(options->BridgeRelay, old_options->BridgeRelay)) { log_info(LD_GENERAL, "Bridge status changed. Forgetting GeoIP stats."); - geoip_remove_old_clients(time(NULL)+3600); + geoip_remove_old_clients(time(NULL)+(2*60*60)); } if (options_transition_affects_workers(old_options, options)) { diff --git a/src/or/geoip.c b/src/or/geoip.c index 64ced6ea90..41c8f21cdb 100644 --- a/src/or/geoip.c +++ b/src/or/geoip.c @@ -310,6 +310,9 @@ geoip_note_client_seen(geoip_client_action_t action, if (action == GEOIP_CLIENT_CONNECT) { if (!(options->BridgeRelay && options->BridgeRecordUsageByCountry)) return; + /* Did we recently switch from bridge to relay or back? */ + if (client_history_starts > now) + return; } else { #ifndef ENABLE_GEOIP_STATS return; @@ -393,7 +396,10 @@ _remove_old_client_helper(struct clientmap_entry_t *ent, void *_cutoff) } } -/** Forget about all clients that haven't connected since <b>cutoff</b>. */ +/** Forget about all clients that haven't connected since <b>cutoff</b>. + * If <b>cutoff</b> is in the future, clients won't be added to the history + * until this time is reached. This is useful to prevent relays that switch + * to bridges from reporting unbelievable numbers of clients. */ void geoip_remove_old_clients(time_t cutoff) { |