Restructurate active hazels

This commit is contained in:
2021-01-05 17:05:03 +01:00
parent 32ff4cbb97
commit 5c9b63d9db
3 changed files with 31 additions and 29 deletions

View File

@@ -163,7 +163,7 @@ class HelloTLV(TLV):
sender.id = self.source_id # The sender we are given misses an id
time_hl = time.time()
else:
time_hl = squirrel.activehazelnuts[(sender.address, sender.port)][2]
time_hl = sender.last_long_hello_time
if self.is_long and self.dest_id == squirrel.id:
time_hl = time.time()
@@ -171,7 +171,10 @@ class HelloTLV(TLV):
squirrel.remove_from_potential(sender.address, sender.port)
# Add entry to/actualize the active hazelnuts dictionnary
squirrel.activehazelnuts[(sender.address, sender.port)] = [sender, time_h, time_hl, True]
sender.last_hello_time = time_h
sender.last_long_hello_time = time_hl
sender.symmetric = True
squirrel.activehazelnuts[(sender.address, sender.port)] = sender
squirrel.nbNS += 1
# squirrel.add_system_message(f"Aaaawwww, {self.source_id} spoke to me and said Hello "
# + ("long" if self.is_long else "short"))