From 94f7231e7375f6ecc485dc49fdb7687557d48e46 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Tue, 25 Jul 2023 19:37:28 -0700 Subject: [PATCH] net: Fix request cancelling. Was broken in #17737. --- Common/Net/NetBuffer.cpp | 8 ++++++-- Common/System/OSD.cpp | 4 ---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Common/Net/NetBuffer.cpp b/Common/Net/NetBuffer.cpp index 6a507977b2..09a4853963 100644 --- a/Common/Net/NetBuffer.cpp +++ b/Common/Net/NetBuffer.cpp @@ -76,11 +76,15 @@ bool Buffer::ReadAllWithProgress(int fd, int knownSize, RequestProgress *progres int total = 0; while (true) { bool ready = false; - while (!ready && (!progress || (progress->cancelled && !*progress->cancelled))) { - if (progress && progress->cancelled && *progress->cancelled) + + // If we might need to cancel, check on a timer for it to be ready. + // After this, we'll block on reading so we do this while first if we have a cancel pointer. + while (!ready && progress && progress->cancelled) { + if (*progress->cancelled) return false; ready = fd_util::WaitUntilReady(fd, CANCEL_INTERVAL, false); } + int retval = recv(fd, &buf[0], (int)buf.size(), MSG_NOSIGNAL); if (retval == 0) { return true; diff --git a/Common/System/OSD.cpp b/Common/System/OSD.cpp index ab1b900e69..1b26acd89e 100644 --- a/Common/System/OSD.cpp +++ b/Common/System/OSD.cpp @@ -235,10 +235,6 @@ void OnScreenDisplay::SetProgressBar(std::string id, std::string &&message, floa } } - if (message == "dorequest.php") { - found = found; - } - ProgressBar bar; bar.id = id; bar.message = std::move(message);