Acknowledge Data TLVs
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
		@@ -212,6 +212,9 @@ class DataTLV(TLV):
 | 
			
		||||
            # The message was already received
 | 
			
		||||
            return
 | 
			
		||||
 | 
			
		||||
        # Acknowledge the packet
 | 
			
		||||
        squirrel.send_packet(sender, Packet.construct(AckTLV.construct(sender.id, self.nonce)))
 | 
			
		||||
 | 
			
		||||
        nickname_match = re.match("(.*): (.*)", msg)
 | 
			
		||||
        if nickname_match is None:
 | 
			
		||||
            squirrel.send_packet(sender, Packet.construct(WarningTLV.construct(
 | 
			
		||||
@@ -263,6 +266,15 @@ class AckTLV(TLV):
 | 
			
		||||
        # TODO Implement AckTLV
 | 
			
		||||
        squirrel.add_system_message("I received an AckTLV. I don't know what to do with it. Please implement me!")
 | 
			
		||||
 | 
			
		||||
    @staticmethod
 | 
			
		||||
    def construct(sender_id: int, nonce: int) -> "AckTLV":
 | 
			
		||||
        tlv = AckTLV()
 | 
			
		||||
        tlv.type = 5
 | 
			
		||||
        tlv.length = 12
 | 
			
		||||
        tlv.sender_id = sender_id
 | 
			
		||||
        tlv.nonce = nonce
 | 
			
		||||
        return tlv
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class GoAwayTLV(TLV):
 | 
			
		||||
    class GoAwayType(Enum):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user