Commit c9440698 authored by Roman Haefeli's avatar Roman Haefeli

dont allow self-connection

parent 6d889df8
......@@ -65,10 +65,11 @@ def addlink():
def addtoken(token, addr):
if token in tokenlookup:
tokenlookup[token].append(addr)
linklookup[tokenlookup[token][0]] = tokenlookup[token][1]
linklookup[tokenlookup[token][1]] = tokenlookup[token][0]
del tokenlookup[token]
if addr not in tokenlookup[token]:
tokenlookup[token].append(addr)
linklookup[tokenlookup[token][0]] = tokenlookup[token][1]
linklookup[tokenlookup[token][1]] = tokenlookup[token][0]
del tokenlookup[token]
else:
tokenlookup[token] = [addr]
......@@ -122,7 +123,7 @@ while True:
try:
addtoken(token[1], srcaddr)
except:
print "error with parsing token"
pass
# forward data according to lookup table
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment