[or-cvs] [tor/master 2/3] Only delay counting bridge users if we were a relay before

nickm at torproject.org nickm at torproject.org
Fri Aug 6 14:45:57 UTC 2010


Author: Sebastian Hahn <sebastian at torproject.org>
Date: Thu, 8 Jul 2010 14:29:04 +0200
Subject: Only delay counting bridge users if we were a relay before
Commit: d365bc965d127e244528b6d15b818d87397724d0

---
 src/or/config.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/or/config.c b/src/or/config.c
index 4c9ab65..1a89268 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.  "
-- 
1.7.1




More information about the tor-commits mailing list