Warn other user is the data contains a zero
This commit is contained in:
parent
c136f34d9c
commit
eb97a47a25
|
@ -301,6 +301,12 @@ class DataTLV(TLV):
|
||||||
"You are not my neighbour, I don't listen to your DataTLV. Please say me Hello before.")))
|
"You are not my neighbour, I don't listen to your DataTLV. Please say me Hello before.")))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if 0 in self.data:
|
||||||
|
user.send_packet(sender, Packet.construct(WarningTLV.construct(
|
||||||
|
f"The length of your DataTLV mismatches. You told me that the length is {len(self.data)} "
|
||||||
|
f"while a zero was found at index {self.data.index(0)}.")))
|
||||||
|
self.data = self.data[:self.data.index(0)]
|
||||||
|
|
||||||
msg = self.data.decode('UTF-8')
|
msg = self.data.decode('UTF-8')
|
||||||
|
|
||||||
# Acknowledge the packet
|
# Acknowledge the packet
|
||||||
|
|
Loading…
Reference in New Issue