diff --git a/squinnondation/messages.py b/squinnondation/messages.py index 531f3c9..faaa7ad 100644 --- a/squinnondation/messages.py +++ b/squinnondation/messages.py @@ -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 diff --git a/squinnondation/squinnondation.py b/squinnondation/squinnondation.py index be8f09d..2b93e9b 100644 --- a/squinnondation/squinnondation.py +++ b/squinnondation/squinnondation.py @@ -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)