[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r15885: tweak fingerprint map logic (blossom/trunk)
Author: goodell
Date: 2008-07-13 23:13:13 -0400 (Sun, 13 Jul 2008)
New Revision: 15885
Modified:
blossom/trunk/blossom.py
Log:
tweak fingerprint map logic
Modified: blossom/trunk/blossom.py
===================================================================
--- blossom/trunk/blossom.py 2008-07-14 02:59:51 UTC (rev 15884)
+++ blossom/trunk/blossom.py 2008-07-14 03:13:13 UTC (rev 15885)
@@ -736,8 +736,8 @@
dest = fpmap[dest]
# test for unconverted fingerprints
- if len(dest) > MAXNICKLEN and re.match(r'^[0-9A-F]+$', dest):
- dest = ""
+ # if len(dest) > MAXNICKLEN and re.match(r'^[0-9A-F]+$', dest):
+ # dest = ""
log_msg(2, "--- normal destination: %s" % dest)
@@ -1462,6 +1462,7 @@
if allrtrs.has_key(x):
return allrtrs[x]["name"]
else:
+ log_msg(2, "CANNOT FIND: %s" % x)
return x
def generate_output(arg):
@@ -1582,7 +1583,7 @@
global summary_remote # WARNING: this is very very bad
seq = []
- desc = {}
+ desc = allrtrs
summary_remote = {}
fail = 0
circID = 0
@@ -1594,6 +1595,7 @@
return
log_msg(2, "*** search to %s" % dest)
+ dest = fingerprint(dest)
while not desc.has_key(dest) and not fail:
chosen_dir = ""
@@ -1714,13 +1716,15 @@
return
def fingerprint(name):
- if fpmap.has_key(name):
+ m = re.match(r'^\$(\S+)$', name)
+ if m:
+ return m.group(1)
+ elif fpmap.has_key(name):
return fpmap[name]
else:
return name
def process_line(line):
- global allrtrs
global circuits
global closed_streams
global counted_streams
@@ -2069,6 +2073,27 @@
# determine router nickname
router = m.group(1).lower()
+ # router-status
+ m = re.search(r'^router-status\s+(.*)$', line)
+ if m:
+ pairs = m.group(1).split(" ")
+ for pair in pairs:
+ m = re.search(r'^\!?(\S+)=\$(\S+)$', pair)
+ if m:
+ name = m.group(1)
+ fp = m.group(2)
+ log_msg(2, "MAP %s -> %s" % (name, fp))
+ fpmap[name] = fp
+ allrtrs[fp] = {
+ "cc" : "~~",
+ "name" : name,
+ "bw" : 0,
+ "addr" : "0.0.0.0",
+ "network" : "unknown"
+ }
+ else:
+ log_msg(2, "NUL %s" % line)
+
# summary
m = re.search(r'^summary\s+(\S+)\s*(\s+(\S+))?$', line)
if m:
@@ -2957,6 +2982,7 @@
# declare other global variables
global addr
+ global allrtrs
global attempted
global circuits
global closed_streams