Skip to content
Snippets Groups Projects
Commit 4a7955a3 authored by Jeffrey Wigger's avatar Jeffrey Wigger
Browse files

refixes tcp routing

parent c69b3fc6
No related branches found
No related tags found
No related merge requests found
......@@ -414,7 +414,7 @@ class TCPRandomWalkRoutingInternal(TCPRandomWalkBase):
if type(data) == tuple and data[0] == HELLO:
logging.debug("Received {} from {}".format(HELLO, src))
if src in self.current_neighbors:
if data[1] != "fw at neighbor":
if data[1] != "fw at neighbor": # TODO: this is wrong
logging.critical(
"{} wants to connect when already connected!".format(HELLO, src)
)
......@@ -499,8 +499,8 @@ class TCPRandomWalkRoutingInternal(TCPRandomWalkBase):
"RW message is delivered here due to no new neighbors being available: %s",
str(data["visited"]),
)
"fw at neighbor"
self.connect(new_data["routing_info"])
# TODO: check if not already a neighbor
#self.connect(new_data["routing_info"])
return
else:
logging.info(
......@@ -632,18 +632,10 @@ class TCPRandomWalkRoutingInternal(TCPRandomWalkBase):
) # True -> we initiated
logging.info(f"Added {sender} to future neighbors")
del self.outgoing_request[sender] # cannot advance until this is empty
elif round < self.current_round: # we are ahead
# TODO: might cause a blocking behaviour, if both start a connection to each other
if self.current_data != None:
self.send(
sender, self.current_data
) # messaging is tcp based --> always arrives after hello
self.current_neighbors.add(sender)
logging.info(f"Added {sender} to current neighbors")
del self.outgoing_request[sender]
elif round == self.current_round - 1: # we are ahead
# should never arrive, as other round should advance and then send to us with current round
logging.info(f"Received a hello from {sender} with {round}")
# raise RuntimeError(f"Received a hello from {sender} with {round}")
logging.critical(f"Received a hello from {sender} with {round}")
raise RuntimeError(f"Received a hello from {sender} with {round}")
else:
logging.critical(f"Received a hello from {sender} with {round}")
raise RuntimeError(f"Received a hello from {sender} with {round}")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment