[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [compass/master] Improve warning
commit 82f879447132dfaf52da8109adf228240afcd52b
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@xxxxxxxxx>
Date: Wed Aug 22 23:36:39 2012 +0530
Improve warning
The warning message now gets called only if two ipv4
addresses are present in or_addresses and doesn't care
about ipv6 ones.
---
compass.py | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/compass.py b/compass.py
index 3e20c96..737f667 100755
--- a/compass.py
+++ b/compass.py
@@ -90,13 +90,15 @@ class SameNetworkFilter(BaseFilter):
def load(self, all_relays):
for relay in all_relays:
or_addresses = relay.get("or_addresses")
- if len(or_addresses) > 1:
- print "[WARNING] - %s has more than two OR Addresses - %s" % relay.get("fingerprint"), or_addresses
+ no_of_addresses = 0
for ip in or_addresses:
ip, port = ip.rsplit(':', 1)
# skip if ipv6
if ':' in ip:
continue
+ no_of_addresses += 1
+ if no_of_addresses > 1:
+ print "[WARNING] - %s has more than two OR Addresses - %s" % relay.get("fingerprint"), or_addresses
network = ip.rsplit('.', 1)[0]
relay_info = self.Relay(relay)
if self.network_data.has_key(network):
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits