LibIPC: Process remaining read bytes before shutting down due to EOF

Previously we would shut down an ipc connection regardless of if there
were still bytes that have been read and not been handed over to
processing, causing WindowServer not to receive
WindowServer::SetFlashFlush messages sent by `wsctl -f` except the first
one.

This patch fixes that behavior by still shutting the connection down due
to having reached EOF while also processing remaining bytes.

Resolves #12954

See also #8912 which fixes the same issue that this patch fixes but also
seems to have initially broken SettingsWindow cancel not actually
closing the window unless the cursor got moved as described in #12003.
Pull request #12547 fixing the SettingsWindow behavior broke `wsctl`
again by always shutting down.
This commit is contained in:
networkException 2022-06-05 13:14:39 +02:00 committed by Linus Groh
parent a705741be3
commit b0461c1522
Notes: sideshowbarker 2024-07-17 10:26:48 +09:00

View file

@ -136,6 +136,8 @@ ErrorOr<Vector<u8>> ConnectionBase::read_as_much_as_possible_from_socket_without
auto bytes_read = maybe_bytes_read.release_value();
if (bytes_read.is_empty()) {
deferred_invoke([this] { shutdown(); });
if (!bytes.is_empty())
break;
return Error::from_string_literal("IPC connection EOF"sv);
}