Skip to content

Commit

Permalink
Remove the __len__() method from all Distributors.
Browse files Browse the repository at this point in the history
  • Loading branch information
isislovecruft committed Apr 19, 2015
1 parent 518a431 commit acaf3c1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
6 changes: 0 additions & 6 deletions lib/bridgedb/Dist.py
Expand Up @@ -346,9 +346,6 @@ def getBridges(self, bridgeRequest, interval):

return answer

def __len__(self):
return len(self.hashring)

def dumpAssignments(self, f, description=""):
self.hashring.dumpAssignments(f, description)

Expand Down Expand Up @@ -474,9 +471,6 @@ def getBridges(self, bridgeRequest, interval):

return result

def __len__(self):
return len(self.hashring)

def cleanDatabase(self):
with bridgedb.Storage.getDB() as db:
try:
Expand Down
4 changes: 2 additions & 2 deletions lib/bridgedb/Main.py
Expand Up @@ -254,7 +254,7 @@ def createBridgeRings(cfg, proxyList, key):
crypto.getHMAC(key, "HTTPS-IP-Dist-Key"),
proxyList,
answerParameters=ringParams)
hashring.addRing(ipDistributor, "https", cfg.HTTPS_SHARE)
hashring.addRing(ipDistributor.hashring, "https", cfg.HTTPS_SHARE)

# As appropriate, create an email-based distributor.
if cfg.EMAIL_DIST and cfg.EMAIL_SHARE:
Expand All @@ -265,7 +265,7 @@ def createBridgeRings(cfg, proxyList, key):
cfg.EMAIL_DOMAIN_RULES.copy(),
answerParameters=ringParams,
whitelist=cfg.EMAIL_WHITELIST.copy())
hashring.addRing(emailDistributor, "email", cfg.EMAIL_SHARE)
hashring.addRing(emailDistributor.hashring, "email", cfg.EMAIL_SHARE)

# As appropriate, tell the hashring to leave some bridges unallocated.
if cfg.RESERVED_SHARE:
Expand Down

0 comments on commit acaf3c1

Please sign in to comment.