From c6b4e7a2f67174b93c3fbc68f6a19dc15ef82172 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 6 Nov 2021 10:43:09 +0100 Subject: [PATCH] LibIPC: Add ClientConnection::shutdown_with_error() Before this, we only had ClientConnection::did_misbehave() to report an error and shut the connection down. But it's not fair to say that *all* errors are the client misbehaving! A typical non-misbehavior is resource allocation failure on the server side. --- Userland/Libraries/LibIPC/ClientConnection.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Userland/Libraries/LibIPC/ClientConnection.h b/Userland/Libraries/LibIPC/ClientConnection.h index 52d8cdcaef..e7817edc01 100644 --- a/Userland/Libraries/LibIPC/ClientConnection.h +++ b/Userland/Libraries/LibIPC/ClientConnection.h @@ -49,6 +49,12 @@ public: this->shutdown(); } + void shutdown_with_error(Error const& error) + { + dbgln("{} (id={}) had error ({}), disconnecting.", *this, m_client_id, error); + this->shutdown(); + } + int client_id() const { return m_client_id; } virtual void die() = 0;