[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [doctor/master] Don't drop relays with identical nicknames
commit 1586ad248bf0ce994bcdb1ffe0261bb829ac59ee
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Mon Sep 30 14:55:03 2013 -0700
Don't drop relays with identical nicknames
When our sybil checker sends notifications it sorts the relays by their
nickname. To do this I constructed a 'nickname => descriptor' hash, but I
forgot nicknames are not always unique. Actually, they very frequently aren't
due to Unnamed entries.
Constructing a 'nickname => [list of descriptors]' hash instead. Caught by
Linus when yatei had an outage since we claimed 60 new relays but only listed
34.
---
sybil_checker.py | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/sybil_checker.py b/sybil_checker.py
index 56f344f..af7c39e 100755
--- a/sybil_checker.py
+++ b/sybil_checker.py
@@ -62,14 +62,19 @@ def main():
def send_email(new_relays):
- # constructs a mapping of nicknames to router status entries so we can provide a listing that's sorted by nicknames
+ # Constructs a mapping of nicknames to router status entries so we can
+ # provide a listing that's sorted by nicknames.
+
+ nickname_to_relay = {}
+
+ for entry in new_relays:
+ nickname_to_relay.setdefault(entry.nickname, []).append(entry)
- nickname_to_relay = dict((entry.nickname, entry) for entry in new_relays)
relay_entries = []
for nickname in sorted(nickname_to_relay.keys()):
- relay = nickname_to_relay[nickname]
- relay_entries.append(RELAY_ENTRY % (relay.nickname, relay.fingerprint, relay.address, relay.or_port, relay.version, relay.exit_policy))
+ for relay in nickname_to_relay[nickname]:
+ relay_entries.append(RELAY_ENTRY % (relay.nickname, relay.fingerprint, relay.address, relay.or_port, relay.version, relay.exit_policy))
try:
body = EMAIL_BODY % len(new_relays)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits