mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-22 02:09:24 +00:00
WindowServer: Improve client write handling a little
* EPIPE now correctly deletes the client connection * EAGAIN (which is now returned by the kernel if the write buffer fills) terminates the connection also
This commit is contained in:
parent
d8b74c8c86
commit
5f597d0cb2
Notes:
sideshowbarker
2024-07-19 14:01:12 +09:00
Author: https://github.com/rburchell
Commit: 5f597d0cb2
Pull-request: https://github.com/SerenityOS/serenity/pull/60
1 changed files with 12 additions and 3 deletions
|
@ -92,12 +92,21 @@ void WSClientConnection::post_message(const WSAPI_ServerMessage& message, const
|
|||
|
||||
int nwritten = writev(m_fd, iov, iov_count);
|
||||
if (nwritten < 0) {
|
||||
if (errno == EPIPE) {
|
||||
switch (errno) {
|
||||
case EPIPE:
|
||||
dbgprintf("WSClientConnection::post_message: Disconnected from peer.\n");
|
||||
delete_later();
|
||||
return;
|
||||
break;
|
||||
case EAGAIN:
|
||||
dbgprintf("WSClientConnection::post_message: Client buffer overflowed.\n");
|
||||
did_misbehave();
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
perror("WSClientConnection::post_message writev");
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
perror("WSClientConnection::post_message writev");
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
ASSERT(nwritten == sizeof(message) + extra_data.size());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue