|
@@ -92,16 +92,18 @@ class db:
|
|
|
for i in this.entries[src - 1]:
|
|
|
# dupe entry
|
|
|
if (connection.link == i.link):
|
|
|
- print("this should be a log")
|
|
|
+ log.write("This was a duplicate packet. Ignoring.")
|
|
|
return False
|
|
|
# not a dupe, insert
|
|
|
this.entries[src - 1].append(connection)
|
|
|
+ print("Link-State DB: ", this.entries, sep='\n')
|
|
|
# update entries and connection to contain
|
|
|
got_dest = connection.infer(this)
|
|
|
# insert into graph if we have the endpoints for this edge
|
|
|
if (got_dest):
|
|
|
graph.insert(connection)
|
|
|
graph.rebuild()
|
|
|
+ graph.show()
|
|
|
# notify neighbours
|
|
|
notify(connection)
|
|
|
return True
|
|
@@ -117,6 +119,9 @@ class graph:
|
|
|
def lookup(this, dest):
|
|
|
return this.sssp[dest - 1]
|
|
|
|
|
|
+ def show(this):
|
|
|
+ print("SSSP: ", this.sssp)
|
|
|
+
|
|
|
def insert(this, connection):
|
|
|
src = connection.src
|
|
|
dest = connection.dest
|