1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:07:45 +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:
Robin Burchell 2019-05-19 10:26:06 +02:00 committed by Andreas Kling
parent d8b74c8c86
commit 5f597d0cb2

View file

@ -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());