Ctrl+C properly stop the program

This commit is contained in:
2021-01-01 19:55:30 +01:00
parent 88ab6f5c76
commit a985dac4b0
3 changed files with 42 additions and 5 deletions

View File

@ -356,7 +356,7 @@ class GoAwayTLV(TLV):
self.type = raw_data[0]
self.length = raw_data[1]
self.code = GoAwayType(raw_data[2])
self.message = raw_data[3:self.length - 1].decode("UTF-8")
self.message = raw_data[3:2 + self.length].decode("UTF-8")
def marshal(self) -> bytes:
return self.type.to_bytes(1, sys.byteorder) + \
@ -376,7 +376,7 @@ class GoAwayTLV(TLV):
tlv.type = 6
tlv.code = ga_type
tlv.message = message
tlv.length = 1 + len(tlv.message)
tlv.length = 1 + len(tlv.message.encode("UTF-8"))
return tlv