[tor-commits] [bridgedb/master] Clarify log messages in EmailBasedDistributor.getBridgesForEmail().

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


commit e3d7a0c04eaa1cc56e9018cf0113c7be1a88c5f6
Author: Isis Lovecruft <isis at torproject.org>
Date:   Sat Jan 11 16:38:20 2014 +0000

    Clarify log messages in EmailBasedDistributor.getBridgesForEmail().
---
 lib/bridgedb/Dist.py |   18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/lib/bridgedb/Dist.py b/lib/bridgedb/Dist.py
index 9a503a6..163916d 100644
--- a/lib/bridgedb/Dist.py
+++ b/lib/bridgedb/Dist.py
@@ -428,18 +428,24 @@ class EmailBasedDistributor(bridgedb.Bridges.BridgeHolder):
         db = bridgedb.Storage.getDB()
         wasWarned = db.getWarnedEmail(emailaddress)
         lastSaw = db.getEmailTime(emailaddress)
+
+        logging.info("Attempting to return for %d bridges for %s..."
+                     % (N, Util.logSafely(emailaddress)))
+
         if lastSaw is not None and lastSaw + MAX_EMAIL_RATE >= now:
+            logging.info("Client %s sent duplicate request within %d seconds."
+                         % (Util.logSafely(emailaddress), MAX_EMAIL_RATE))
             if wasWarned:
-                logging.info("Got a request for bridges from %r; we already "
-                             "sent a warning. Ignoring.", Util.logSafely(emailaddress))
-                raise IgnoreEmail("Client was warned", Util.logSafely(emailaddress))
+                logging.info(
+                    "Client was already warned about duplicate requests.")
+                raise IgnoreEmail("Client was warned",
+                                  Util.logSafely(emailaddress))
             else:
+                logging.info("Sending duplicate request warning to %s..."
+                             % Util.logSafely(emailaddress))
                 db.setWarnedEmail(emailaddress, True, now)
                 db.commit()
 
-            logging.info("Got a request for bridges from %r; we already "
-                         "answered one within the last %d seconds. Warning.",
-                         Util.logSafely(emailaddress), MAX_EMAIL_RATE)
             raise TooSoonEmail("Too many emails; wait till later", emailaddress)
 
         # warning period is over





More information about the tor-commits mailing list