1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 16:28:11 +00:00

Kernel: Report EAGAIN from read() on a non-blocking socket if the buffer is empty

This is not EOF, and never should have been so -- can trip up other code
when porting.

Also updates LibGUI and WindowServer which both relied on the old
behaviour (and didn't work without changes). There may be others, but I
didn't run into them with a quick inspection.
This commit is contained in:
Robin Burchell 2019-05-20 01:18:33 +02:00 committed by Andreas Kling
parent 40a5eb4e6e
commit a8864dc590
3 changed files with 20 additions and 11 deletions

View file

@ -301,7 +301,7 @@ void WSEventLoop::drain_client(WSClientConnection& client)
WSAPI_ClientMessage message;
// FIXME: Don't go one message at a time, that's so much context switching, oof.
ssize_t nread = read(client.fd(), &message, sizeof(WSAPI_ClientMessage));
if (nread == 0) {
if (nread == 0 || (nread == -1 && errno == EAGAIN)) {
if (!messages_received)
post_event(client, make<WSClientDisconnectedNotification>(client.client_id()));
break;