From b0461c1522381d0e113a6db4809a82298865edb7 Mon Sep 17 00:00:00 2001 From: networkException Date: Sun, 5 Jun 2022 13:14:39 +0200 Subject: [PATCH] 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. --- Userland/Libraries/LibIPC/Connection.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Userland/Libraries/LibIPC/Connection.cpp b/Userland/Libraries/LibIPC/Connection.cpp index 0b433648589..9cb6e5e385f 100644 --- a/Userland/Libraries/LibIPC/Connection.cpp +++ b/Userland/Libraries/LibIPC/Connection.cpp @@ -136,6 +136,8 @@ ErrorOr> 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); }