Implemented the inundation, strange type error encountered when testing
This commit is contained in:
@ -165,8 +165,11 @@ class HelloTLV(TLV):
|
||||
timeHL = squirrel.activehazelnuts[(sender.address, sender.port)]
|
||||
if self.is_long and self.dest_id == squirrel.id :
|
||||
timeHL = time.time()
|
||||
|
||||
#Make sure the sender is not in the potential hazelnuts
|
||||
squirrel.remove_from_potential(sender.address, sender.port)
|
||||
|
||||
|
||||
#Add entry to/actualize the active hazelnuts dictionnary
|
||||
squirrel.activehazelnuts[(sender.address, sender.port)] = [sender, timeH,\
|
||||
timeHL, True]
|
||||
squirrel.nbNS += 1
|
||||
@ -260,7 +263,7 @@ class DataTLV(TLV):
|
||||
# Acknowledge the packet
|
||||
squirrel.send_packet(sender, Packet.construct(AckTLV.construct(self.sender_id, self.nonce)))
|
||||
|
||||
if not squirrel.receive_message_from(msg, self.sender_id, self.nonce):
|
||||
if not squirrel.receive_message_from(self, msg, self.sender_id, self.nonce, sender):
|
||||
# The message was already received, do not print it
|
||||
return
|
||||
|
||||
@ -312,8 +315,11 @@ class AckTLV(TLV):
|
||||
socket.htonl(self.nonce).to_bytes(4, sys.byteorder)
|
||||
|
||||
def handle(self, squirrel: Any, sender: Any) -> None:
|
||||
# TODO Implement AckTLV
|
||||
squirrel.add_system_message("I received an AckTLV. I don't know what to do with it. Please implement me!")
|
||||
"""
|
||||
When an AckTLV is received, we know that we do not have to inundate that neighbour anymore.
|
||||
"""
|
||||
squirrel.add_system_message("I received an AckTLV")
|
||||
squirrel.remove_from_inundation(sender, self.sender_id, self.nonce)
|
||||
|
||||
@staticmethod
|
||||
def construct(sender_id: int, nonce: int) -> "AckTLV":
|
||||
|
Reference in New Issue
Block a user