[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [metrics-tasks/master] #6329 Only show families as accepted by consensus (mutually listed relays)



commit 4f74b76c9f669db5dbebd2e8ed09b20c5e2d54a0
Author: Michael Zeltner <m@xxxxxxxx>
Date:   Tue Aug 7 14:35:32 2012 +0200

    #6329 Only show families as accepted by consensus (mutually listed relays)
---
 task-6329/tor-relays-stats.py |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/task-6329/tor-relays-stats.py b/task-6329/tor-relays-stats.py
index d966f66..733bb55 100755
--- a/task-6329/tor-relays-stats.py
+++ b/task-6329/tor-relays-stats.py
@@ -44,17 +44,16 @@ class FamilyFilter(BaseFilter):
             self._family_relays = [self._family_fingerprint] + found_relay.get('family', [])
 
     def accept(self, relay):
-       fingerprint = '$%s' % relay['fingerprint']
-       mentions = [fingerprint] + relay.get('family', [])
-       if fingerprint in self._family_relays:
-           return True
-       if 'Named' in relay['flags'] and relay['nickname'] in self._family_relays:
-           return True
-       if self._family_fingerprint in mentions:
-           return True
-       if self._family_nickname in mentions:
-           return True
-       return False
+        fingerprint = '$%s' % relay['fingerprint']
+        mentions = [fingerprint] + relay.get('family', [])
+        # Only show families as accepted by consensus (mutually listed relays)
+        listed = fingerprint in self._family_relays
+        listed = listed or 'Named' in relay['flags'] and relay['nickname'] in self._family_relays
+        mentioned = self._family_fingerprint in mentions
+        mentioned = mentioned or self._family_nickname in mentions
+        if listed and mentioned:
+            return True
+        return False
 
 class CountryFilter(BaseFilter):
     def __init__(self, countries=[]):

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits