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:
parent
d8b74c8c86
commit
5f597d0cb2
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