[tor-commits] [bridgedb/master] Filter non-pseudo distributors early to omit disaster.

karsten at torproject.org karsten at torproject.org
Thu Mar 31 13:20:03 UTC 2011


commit 4bd711cd3b660d9b6e2870bc9bc0c0eb24692a86
Author: Christian Fromme <kaner at strace.org>
Date:   Thu Mar 31 13:34:13 2011 +0200

    Filter non-pseudo distributors early to omit disaster.
---
 lib/bridgedb/Bucket.py |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/lib/bridgedb/Bucket.py b/lib/bridgedb/Bucket.py
index 066b115..67f3774 100644
--- a/lib/bridgedb/Bucket.py
+++ b/lib/bridgedb/Bucket.py
@@ -168,6 +168,10 @@ class BucketManager:
                 self.addToUnallocatedList(bridge.hex_key)
                 continue
 
+            # Filter 'https' and 'email' early, too
+            if not bridge.distributor.startswith(self.distributor_prefix):
+                continue
+
             # Return the bucket in case we know it already
             d = self.getBucketByIdent(bridge.distributor)
             if d is not None:
@@ -176,14 +180,11 @@ class BucketManager:
                 if d.allocated < d.needed:
                     d.allocated += 1
                 else:
+                    # Bucket has enough members already, free this one
                     self.addToUnallocatedList(bridge.hex_key)
             # We don't know it. Maybe an old entry. Free it.
             else:
-                # DON'T free anything important!
-                if bridge.distributor.startswith(self.distributor_prefix):
-                    self.addToUnallocatedList(bridge.hex_key)
-                # else 
-                #   SCREAM_LOUDLY? 
+                self.addToUnallocatedList(bridge.hex_key)
 
         # Loop though bucketList while we have and need unallocated 
         # bridges, assign one bridge at a time





More information about the tor-commits mailing list