klippy_connection: log raw peercred data on error

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-06-29 06:01:48 -04:00
parent 0a0993f9e0
commit 835e49c10e
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
1 changed files with 4 additions and 1 deletions

View File

@ -233,13 +233,16 @@ class KlippyConnection:
"Unable to get Unix Socket, cant fetch peer credentials"
)
return
data: bytes = b""
try:
data = sock.getsockopt(socket.SOL_SOCKET, socket.SO_PEERCRED, 12)
pid, uid, gid = struct.unpack("@LLL", data)
except asyncio.CancelledError:
raise
except Exception:
logging.exception("Failed to get Klippy Credentials")
logging.exception(
f"Failed to get Klippy Peer Credentials, raw: 0x{data.hex()}"
)
return
self._peer_cred = {
"process_id": pid,