Update the full hazelnuts table when adding a new potential neighbour

This commit is contained in:
Yohann D'ANELLO 2021-01-05 18:22:34 +01:00
parent 311e1539f9
commit 95a2501e49
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
2 changed files with 5 additions and 3 deletions

View File

@ -229,8 +229,9 @@ class NeighbourTLV(TLV):
return
if not (str(self.ip_address), self.port) in squirrel.activehazelnuts \
and not (str(self.ip_address), self.port) in squirrel.potentialhazelnuts:
squirrel.potentialhazelnuts[(str(self.ip_address), self.port)] = \
squirrel.new_hazel(str(self.ip_address), self.port)
hazelnut = squirrel.new_hazel(str(self.ip_address), self.port)
hazelnut.potential = True
squirrel.update_hazelnut_table(hazelnut)
# squirrel.add_system_message(f"New potential friend {self.ip_address}:{self.port}!")
@staticmethod

View File

@ -78,7 +78,8 @@ class Squinnondation:
if instance.args.client_address and instance.args.client_port:
hazelnut = Hazelnut(address=instance.args.client_address, port=instance.args.client_port)
squirrel.potentialhazelnuts[instance.args.client_address, instance.args.client_port] = hazelnut
hazelnut.potential = True
squirrel.update_hazelnut_table(hazelnut)
htlv = HelloTLV().construct(8, squirrel)
pkt = Packet().construct(htlv)
squirrel.send_packet(hazelnut, pkt)