Repaired a few bugs in inundation (and the bug notes in the last commit)
This commit is contained in:
@ -162,7 +162,7 @@ class HelloTLV(TLV):
|
||||
sender.id = self.source_id #The sender we are given misses an id
|
||||
timeHL = time.time()
|
||||
else :
|
||||
timeHL = squirrel.activehazelnuts[(sender.address, sender.port)]
|
||||
timeHL = squirrel.activehazelnuts[(sender.address, sender.port)][2]
|
||||
if self.is_long and self.dest_id == squirrel.id :
|
||||
timeHL = time.time()
|
||||
|
||||
@ -173,8 +173,8 @@ class HelloTLV(TLV):
|
||||
squirrel.activehazelnuts[(sender.address, sender.port)] = [sender, timeH,\
|
||||
timeHL, True]
|
||||
squirrel.nbNS += 1
|
||||
squirrel.add_system_message(f"Aaaawwww, {self.source_id} spoke to me and said me Hello "
|
||||
+ ("long" if self.is_long else "short"))
|
||||
#squirrel.add_system_message(f"Aaaawwww, {self.source_id} spoke to me and said me Hello "
|
||||
# + ("long" if self.is_long else "short"))
|
||||
|
||||
@property
|
||||
def is_long(self) -> bool:
|
||||
@ -216,7 +216,7 @@ class NeighbourTLV(TLV):
|
||||
def handle(self, squirrel: Any, sender: Any) -> None:
|
||||
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)
|
||||
squirrel.add_system_message(f"New potential friend {self.ip_address}:{self.port}!")
|
||||
#squirrel.add_system_message(f"New potential friend {self.ip_address}:{self.port}!")
|
||||
|
||||
@staticmethod
|
||||
def construct(address: str, port: int) -> "NeighbourTLV":
|
||||
@ -265,6 +265,7 @@ class DataTLV(TLV):
|
||||
|
||||
if not squirrel.receive_message_from(self, msg, self.sender_id, self.nonce, sender):
|
||||
# The message was already received, do not print it
|
||||
squirrel.add_system_message(f"I was inundated a message which I already knew {self.sender_id, self.nonce}")
|
||||
return
|
||||
|
||||
nickname_match = re.match("(.*): (.*)", msg)
|
||||
|
Reference in New Issue
Block a user