[or-cvs] r14677: make router restrictions work for exit.py (blossom/trunk)

goodell at seul.org goodell at seul.org
Tue May 20 05:50:04 UTC 2008


Author: goodell
Date: 2008-05-20 01:50:03 -0400 (Tue, 20 May 2008)
New Revision: 14677

Modified:
   blossom/trunk/exit.py
Log:
make router restrictions work for exit.py


Modified: blossom/trunk/exit.py
===================================================================
--- blossom/trunk/exit.py	2008-05-20 04:48:04 UTC (rev 14676)
+++ blossom/trunk/exit.py	2008-05-20 05:50:03 UTC (rev 14677)
@@ -234,13 +234,14 @@
                 "netname"   : a
             }
         c = addr[a]["cc"]
-        if not router_set.has_key(c):
-            router_set[c] = []
-        router_set[c].append(r)
-        if m_country.has_key(c):
-            rtr[r]["country"] = m_country[c]
-        else:
-            rtr[r]["country"] = "~~"
+        if rtr.has_key(r):
+            if not router_set.has_key(c):
+                router_set[c] = []
+            router_set[c].append(r)
+            if m_country.has_key(c):
+                rtr[r]["country"] = m_country[c]
+            else:
+                rtr[r]["country"] = "~~"
 
 # organize bandwidths for statistics
 
@@ -282,11 +283,17 @@
                 rtr[r]["bwsymbol"] = "v3"
             elif rtr[r]["bandwidth"] > x_bandwidth[int(len(x_bandwidth)/2)]:
                 rtr[r]["bwsymbol"] = "v2"
-    for property in ["Stable", "Guard", "Authority", "Disputed"]:
-        property_str = property
+    property_str = ""
+    for property in ["Exit", "Stable", "Guard", "Authority", "Disputed"]:
         if rtr[r]["status"].has_key(property):
+            if "Guard" == property and ("Exit" == property_str or "StableExit" == property_str):
+                property_str = "GuardExit"
+            elif "Stable" == property and "Exit" == property_str:
+                property_str = "StableExit"
+            else:
+                property_str = property
             extra = "<acronym title=\"%s\"><img src=\"%s/%s.png\" alt=\"%s\"></acronym>" \
-                % (property_str, URL_ICONS, property, property)
+                % (property_str, URL_ICONS, property_str, property_str)
 
     if rtr[r]["orport"] == 443:
         c_orport = "c5"
@@ -473,9 +480,11 @@
         category_name = c
     else:
         category_name = m_country[c]
+    count = 0
     for r in router_set[c]:
-        rows += rtr[r]["entry"]
-    count = len(router_set[c])
+        if rtr.has_key(r):
+            rows += rtr[r]["entry"]
+            count += 1
     if count:
         if f:
             f = 0
@@ -558,7 +567,7 @@
 
 <p><tt>total:&nbsp;%d</tt></p>
 
-<p><tt>transaction completed in %d seconds</tt></p>
+<p><tt>transaction completed in %d second(s)</tt></p>
 
 <p><tt><a href="http://%s/~goodell/blossom/src/exit.py">source code</a></tt></p>
 



More information about the tor-commits mailing list