Commit e4593a42 authored by Tom Niget's avatar Tom Niget

Log error when x509 utf8 decoding failure

parent 8ffec7e3
...@@ -303,7 +303,11 @@ class Peer: ...@@ -303,7 +303,11 @@ class Peer:
if self._hmac(msg[:i]) == msg[i:] and self._i < seqno: if self._hmac(msg[:i]) == msg[i:] and self._i < seqno:
self._last = None self._last = None
self._i = seqno self._i = seqno
try:
return msg[4:i].decode() return msg[4:i].decode()
except UnicodeDecodeError:
logging.error("Invalid message from %s: %r", self.prefix, msg)
raise
def encode(self, msg: str | bytes, _pack=seqno_struct.pack) -> bytes: def encode(self, msg: str | bytes, _pack=seqno_struct.pack) -> bytes:
self._j += 1 self._j += 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment