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

fixed byes 2

parent 598ddab1
No related branches found
No related tags found
No related merge requests found
......@@ -796,16 +796,17 @@ class TCPRandomWalkRoutingInternal(TCPRandomWalkBase):
)
self.this_round_bye.add(sender)
r_was = self.outgoing_byes[sender]
del self.outgoing_byes[sender]
logging.info(f"added {sender} to this round's byes")
# raise RuntimeError(
# f"Received a hello from {sender} with {bye[1]} (one behind us)"
# )
if self.outgoing_byes[sender] != bye[1] + 1:
if r_was != bye[1] + 1:
# Should not happen as they are connected
print(f"A bye was received from {sender} that is behind more than one {bye[1]}")
logging.info(f"A bye was received from {sender} that is behind more than one {bye[1]}")
print(f"A bye was received at {r_was} from {sender} that is behind more than one {bye[1]}")
logging.info(f"A bye was received at {r_was} from {sender} that is behind more than one {bye[1]}")
elif self.outgoing_byes[sender] < bye[1]: # We are behind
# We know with certainty that the next round we disconnect (will still send the data)
# final disconnect is handled in delivery
......@@ -815,12 +816,13 @@ class TCPRandomWalkRoutingInternal(TCPRandomWalkBase):
(sender, True)
) # TODO: makes sure all entries at bye[1] get deleted in delivery
logging.info(f"added {sender} to round {bye[1]} byes")
r_was = self.outgoing_byes[sender]
del self.outgoing_byes[sender]
# need to remove it else cannot advance
if self.outgoing_byes[sender] != bye[1] - 1:
if r_was != bye[1] - 1:
# Should not happen as they are connected
print(f"A bye was received from {sender} that is ahead more than one {bye[1]}")
logging.info(f"A bye was received from {sender} that is ahead more than one {bye[1]}")
print(f"A bye was received at {r_was} from {sender} that is ahead more than one {bye[1]}")
logging.info(f"A bye was received at {r_was} from {sender} that is ahead more than one {bye[1]}")
else: # this goodbye was not initiated by us
logging.debug(f"sender {sender} not in outgoing byes")
all_to_be_removed = self.this_round_bye.union(
......
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