A hazelut is either active or potential
This commit is contained in:
parent
95a2501e49
commit
5ffe0d21c3
|
@ -25,7 +25,6 @@ class Hazelnut:
|
|||
self.last_long_hello_time = 0
|
||||
self.symmetric = False
|
||||
self.active = False
|
||||
self.potential = False
|
||||
|
||||
try:
|
||||
# Resolve DNS as an IPv6
|
||||
|
@ -39,6 +38,14 @@ class Hazelnut:
|
|||
self.address = address # IPv6Address(address)
|
||||
self.port = port
|
||||
|
||||
@property
|
||||
def potential(self) -> bool:
|
||||
return not self.active
|
||||
|
||||
@potential.setter
|
||||
def potential(self, value: bool) -> None:
|
||||
self.active = not value
|
||||
|
||||
|
||||
class Squirrel(Hazelnut):
|
||||
"""
|
||||
|
@ -648,7 +655,6 @@ class Squirrel(Hazelnut):
|
|||
pkt = Packet().construct(gatlv)
|
||||
self.send_packet(hazelnut, pkt)
|
||||
hazelnut.active = False
|
||||
hazelnut.potential = True
|
||||
self.update_hazelnut_table(hazelnut)
|
||||
|
||||
self.refresh_lock.release()
|
||||
|
|
|
@ -171,7 +171,6 @@ class HelloTLV(TLV):
|
|||
sender.last_hello_time = time_h
|
||||
sender.last_long_hello_time = time_hl
|
||||
sender.symmetric = True
|
||||
sender.potential = False
|
||||
sender.active = True
|
||||
squirrel.update_hazelnut_table(sender)
|
||||
squirrel.nbNS += 1
|
||||
|
@ -376,7 +375,6 @@ class GoAwayTLV(TLV):
|
|||
def handle(self, squirrel: Any, sender: Any) -> None:
|
||||
if sender.active:
|
||||
sender.active = False
|
||||
sender.potential = True
|
||||
squirrel.update_hazelnut_table(sender)
|
||||
squirrel.add_system_message("Some told me that he went away : " + self.message)
|
||||
|
||||
|
|
Loading…
Reference in New Issue