mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 19:45:12 +00:00
LibIPC: Fix server crashes on client disconnects
The server should always survive client communication errors.
This commit is contained in:
parent
4aa3d08e21
commit
8449f0a15b
Notes:
sideshowbarker
2024-07-19 05:56:05 +09:00
Author: https://github.com/bugaevc Commit: https://github.com/SerenityOS/serenity/commit/8449f0a15bc Pull-request: https://github.com/SerenityOS/serenity/pull/2462
1 changed files with 7 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue