Merge clients that have the same id if it speaks on multiple addresses

This commit is contained in:
2021-01-05 20:05:19 +01:00
parent 56020390b2
commit 2d670a56a1
3 changed files with 26 additions and 2 deletions

View File

@@ -167,6 +167,13 @@ class HelloTLV(TLV):
if self.is_long and self.dest_id == squirrel.id:
time_hl = time.time()
if sender.id != self.source_id:
squirrel.send_packet(sender, Packet.construct(WarningTLV.construct(
f"You were known as the ID {sender.id}, but you declared that you have the ID {self.source_id}.")))
squirrel.add_system_message(f"A client known as the id {sender.id} declared that it uses "
f"the id {self.source_id}.")
sender.id = self.source_id
# Add entry to/actualize the active hazelnuts dictionnary
sender.last_hello_time = time_h
sender.last_long_hello_time = time_hl