diff options
author | Sergey Bugaev <bugaevc@serenityos.org> | 2020-05-30 22:37:24 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-30 22:31:08 +0200 |
commit | 8449f0a15bca9cfd0c1a727a9319cb08d83a6426 (patch) | |
tree | a4be262157e90664931952d41134c1bdd048cd1c /Libraries/LibIPC/ClientConnection.h | |
parent | 4aa3d08e214b0bd010bbba2d707fb26ea6886762 (diff) | |
download | serenity-8449f0a15bca9cfd0c1a727a9319cb08d83a6426.zip |
LibIPC: Fix server crashes on client disconnects
The server should always survive client communication errors.
Diffstat (limited to 'Libraries/LibIPC/ClientConnection.h')
-rw-r--r-- | Libraries/LibIPC/ClientConnection.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Libraries/LibIPC/ClientConnection.h b/Libraries/LibIPC/ClientConnection.h index d1a7803425..0a821cd296 100644 --- a/Libraries/LibIPC/ClientConnection.h +++ b/Libraries/LibIPC/ClientConnection.h @@ -121,7 +121,8 @@ public: return; default: perror("Connection::post_message write"); - ASSERT_NOT_REACHED(); + shutdown(); + return; } } @@ -130,6 +131,9 @@ public: void drain_messages_from_client() { + if (!m_socket->is_open()) + return; + Vector<u8> bytes; for (;;) { u8 buffer[4096]; @@ -143,7 +147,8 @@ public: } if (nread < 0) { perror("recv"); - ASSERT_NOT_REACHED(); + shutdown(); + return; } bytes.append(buffer, nread); } |