From 0be5aa3afe78db676949601d73940f91fcd04544 Mon Sep 17 00:00:00 2001 From: John Lee Date: Thu, 11 Jul 2024 16:40:14 -0400 Subject: [PATCH] Revert "Close socket immediately for fire and forget commands" --- BedrockServer.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/BedrockServer.cpp b/BedrockServer.cpp index ec26f5ea8..14397b327 100644 --- a/BedrockServer.cpp +++ b/BedrockServer.cpp @@ -2139,12 +2139,14 @@ unique_ptr BedrockServer::buildCommandFromRequest(SData&& reques bool fireAndForget = false; if (SIEquals(request["Connection"], "forget") || (uint64_t)request.calc64("commandExecuteTime") > STimeNow()) { - // Respond immediately to make it clear we successfully queued it. We won't store the socket on the command. + // Respond immediately to make it clear we successfully queued it, but don't return the socket to indicate we + // don't need to respond. SINFO("Firing and forgetting '" << request.methodLine << "'"); SData response("202 Successfully queued"); - response["Connection"] = "close"; + if (_shutdownState.load() != RUNNING) { + response["Connection"] = "close"; + } socket.send(response.serialize()); - socket.shutdown(Socket::CLOSED); fireAndForget = true; // If we're shutting down, discard this command, we won't wait for the future.