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

[or-cvs] r24016: {blossom} generalize address mappings for display (blossom/trunk)



Author: goodell
Date: 2011-01-01 20:10:44 +0000 (Sat, 01 Jan 2011)
New Revision: 24016

Modified:
   blossom/trunk/blossom2.py
Log:
generalize address mappings for display


Modified: blossom/trunk/blossom2.py
===================================================================
--- blossom/trunk/blossom2.py	2011-01-01 13:50:12 UTC (rev 24015)
+++ blossom/trunk/blossom2.py	2011-01-01 20:10:44 UTC (rev 24016)
@@ -167,7 +167,10 @@
                                     "~"
                                 )]
                             ),
-                            x[:21]
+                            self.server.data.get(
+                                "network-status",
+                                {}
+                            ).get(x, x)[:21]
                         ),
                         cls="leftentry"
                     ),
@@ -426,6 +429,11 @@
             filter(bool, data["address-mappings/all"].split("\n"))
         )
     ))
+    data["network-status"] = dict(map(
+        lambda r: r.split("=") if len(r.split("=")) == 2 \
+            else (r.split("~")[0], r.split("~")[0]),
+        data["network-status"].split(" ")
+    ))
     for (stream_id, r) in data["stream-status"].items():
         circ = data["circuit-status"].get(r["circuit"])
         if circ:
@@ -467,7 +475,8 @@
                 elif data["circuit-status"].has_key(circ_id):
                     del data["circuit-status"][circ_id]
                 else:
-                    blog("unrecognized %s" % msg)
+                    blog("unrecognized %s" % " ".join(msg))
+                blog(" ".join(msg))
             elif "STREAM" == msg[0]:
                 stream_id = int(msg[1])
                 if msg[2] in ("CLOSED", "FAILED", "REMAP", "DETACHED"):
@@ -561,8 +570,6 @@
         EVENT_TYPE.ADDRMAP
     ])
 
-    print data.get("address-mappings/all")
-
     ClientRequestHandler.protocol_version = "HTTP/1.1"
     while 1:
         try: