commit 92eb6fe9e7d4e1e7cbb72687b9f41f5f827fa182 Author: Matthew Finkel Matthew.Finkel@gmail.com Date: Tue Mar 4 03:59:41 2014 +0000
Only add a bridge to the splitter if it is new.
If it's not new then we want to overwrite the old instance. Unconditionally appending to to the splitter results in duplicate bridges.
Closes #9264 --- lib/bridgedb/Bridges.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/bridgedb/Bridges.py b/lib/bridgedb/Bridges.py index e5d5921..1dc4f4e 100644 --- a/lib/bridgedb/Bridges.py +++ b/lib/bridgedb/Bridges.py @@ -1250,7 +1250,15 @@ class FilteredBridgeSplitter(BridgeHolder): % Util.logSafely(bridge.fingerprint)) return
- self.bridges.append(bridge) + index = 0 + logging.debug("Inserting %s into %s ring" % (bridge.fingerprint, self.key)) + for old_bridge in self.bridges: + if bridge.fingerprint == old_bridge.fingerprint: + self.bridges[index] = bridge + break + index += 1 + else: + self.bridges.append(bridge) for ringname, (filterFn, subring) in self.filterRings.items(): if filterFn(bridge): subring.insert(bridge)
tor-commits@lists.torproject.org