From: Sebastian Hahn Date: Thu, 8 Jul 2010 12:29:04 +0000 (+0200) Subject: Only delay counting bridge users if we were a relay before X-Git-Tag: tor-0.2.2.15-alpha~42^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d365bc965d127e244528b6d15b818d87397724d0;p=thirdparty%2Ftor.git Only delay counting bridge users if we were a relay before --- diff --git a/src/or/config.c b/src/or/config.c index 4c9ab6525e..1a89268006 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -1245,11 +1245,24 @@ options_act(or_options_t *old_options) circuit_expire_all_dirty_circs(); } +/* How long should we delay counting bridge stats after becoming a bridge? + * We use this so we don't count people who used our bridge thinking it is + * a relay. If you change this, don't forget to change the log message + * below. */ +#define RELAY_BRIDGE_STATS_DELAY (2 * 60 * 60) + if (! bool_eq(options->BridgeRelay, old_options->BridgeRelay)) { + int was_relay = 0; if (options->BridgeRelay) { - geoip_bridge_stats_init(time(NULL) + (2 * 60 * 60)); + time_t int_start = time(NULL); + if (old_options->ORPort == options->ORPort) { + int_start += RELAY_BRIDGE_STATS_DELAY; + was_relay = 1; + } + geoip_bridge_stats_init(int_start); log_info(LD_CONFIG, "We are acting as a bridge now. Starting new " - "GeoIP stats interval in 2 hours from now."); + "GeoIP stats interval%s.", was_relay ? " in 2 " + "hours from now" : ""); } else { geoip_bridge_stats_term(); log_info(LD_GENERAL, "We are no longer acting as a bridge. "