klippy_connection: handle credential exceptions
Handle exceptions should the attempt to fetch peer credentials on the unix socket fail. This isn't a hard requirement for connection and should not cause the connection to abort. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
b21f909705
commit
7631999c8f
|
@ -232,8 +232,14 @@ class KlippyConnection:
|
|||
"Unable to get Unix Socket, cant fetch peer credentials"
|
||||
)
|
||||
return
|
||||
data = sock.getsockopt(socket.SOL_SOCKET, socket.SO_PEERCRED, 12)
|
||||
pid, uid, gid = struct.unpack("@LLL", data)
|
||||
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")
|
||||
return
|
||||
self._peer_cred = {
|
||||
"process_id": pid,
|
||||
"user_id": uid,
|
||||
|
|
Loading…
Reference in New Issue