[tor-commits] [bridgedb/master] Add additional log statements to bridgedb.Main.startup().

isis at torproject.org isis at torproject.org
Sun Jan 12 06:06:31 UTC 2014


commit 5ac1057be95c44996b1a8b1288eb3bed47376f24
Author: Isis Lovecruft <isis at torproject.org>
Date:   Tue Nov 5 08:14:12 2013 +0000

    Add additional log statements to bridgedb.Main.startup().
    
     * ADD additional log statements to notify when each distributor is setup and
       when config options are changed on the config instance.
---
 lib/bridgedb/Main.py |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/lib/bridgedb/Main.py b/lib/bridgedb/Main.py
index 502d754..1480c10 100644
--- a/lib/bridgedb/Main.py
+++ b/lib/bridgedb/Main.py
@@ -291,6 +291,7 @@ def startup(cfg, options):
     # Create a BridgeSplitter to assign the bridges to the different
     # distributors.
     splitter = Bridges.BridgeSplitter(Bridges.get_hmac(key, "Splitter-Key"))
+    logging.debug("Created splitter: %r" % splitter)
 
     # Create ring parameters.
     forcePorts = getattr(cfg, "FORCE_PORTS")
@@ -303,9 +304,13 @@ def startup(cfg, options):
     emailDistributor = ipDistributor = None
     # As appropriate, create an IP-based distributor.
     if cfg.HTTPS_DIST and cfg.HTTPS_SHARE:
+        logging.debug("Setting up HTTPS Distributor...")
         categories = []
         if proxyList.ipset:
+            logging.debug("Adding proxyList to HTTPS Distributor categories.")
             categories.append(proxyList)
+        logging.debug("HTTPS Distributor categories: '%s'" % categories)
+
         ipDistributor = Dist.IPBasedDistributor(
             Dist.uniformMap,
             cfg.N_IP_CLUSTERS,
@@ -320,6 +325,8 @@ def startup(cfg, options):
     if cfg.EMAIL_DIST and cfg.EMAIL_SHARE:
         for d in cfg.EMAIL_DOMAINS:
             cfg.EMAIL_DOMAIN_MAP[d] = d
+        logging.debug("New email domain map: '%s'" % cfg.EMAIL_DOMAIN_MAP)
+        logging.debug("Setting up Email Distributor...")
         emailDistributor = Dist.EmailBasedDistributor(
             Bridges.get_hmac(key, "Email-Dist-Key"),
             cfg.EMAIL_DOMAIN_MAP.copy(),
@@ -357,11 +364,16 @@ def startup(cfg, options):
         proxyList.replaceProxyList(loadProxyList(cfg))
         logging.info("%d bridges loaded", len(splitter))
         if emailDistributor:
+            logging.debug("Prepopulating email distributor hashrings...")
             emailDistributor.prepopulateRings() # create default rings
-            logging.info("%d for email", len(emailDistributor.splitter))
+            logging.info("Bridges allotted for email distribution: %d"
+                         % len(emailDistributor.splitter))
+
         if ipDistributor:
+            logging.debug("Prepopulating HTTPS distributor hashrings...")
             ipDistributor.prepopulateRings() # create default rings
-            logging.info("%d for web:", len(ipDistributor.splitter))
+            logging.info("Bridges allotted for web distribution: %d"
+                         % len(ipDistributor.splitter))
             for (n,(f,r)) in ipDistributor.splitter.filterRings.items():
                 logging.info("\tby filter set %s, %d" % (n, len(r)))
             #logging.info("  by location set: %s",





More information about the tor-commits mailing list