summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibIPC
diff options
context:
space:
mode:
authornetworkException <git@nwex.de>2022-06-05 13:14:39 +0200
committerLinus Groh <mail@linusgroh.de>2022-06-05 22:10:02 +0100
commitb0461c1522381d0e113a6db4809a82298865edb7 (patch)
treeb4f6d6645b0e7012b008ddbc06608f85dffc2eae /Userland/Libraries/LibIPC
parenta705741be393ea5489fc598637e521c9ef718895 (diff)
downloadserenity-b0461c1522381d0e113a6db4809a82298865edb7.zip
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.
Diffstat (limited to 'Userland/Libraries/LibIPC')
-rw-r--r--Userland/Libraries/LibIPC/Connection.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Userland/Libraries/LibIPC/Connection.cpp b/Userland/Libraries/LibIPC/Connection.cpp
index 0b43364858..9cb6e5e385 100644
--- a/Userland/Libraries/LibIPC/Connection.cpp
+++ b/Userland/Libraries/LibIPC/Connection.cpp
@@ -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);
}