瀏覽代碼

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.
Andreas Kling 3 年之前
父節點
當前提交
c6b4e7a2f6
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      Userland/Libraries/LibIPC/ClientConnection.h

+ 6 - 0
Userland/Libraries/LibIPC/ClientConnection.h

@@ -49,6 +49,12 @@ public:
         this->shutdown();
         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; }
     int client_id() const { return m_client_id; }
 
 
     virtual void die() = 0;
     virtual void die() = 0;