Skip to content

Commit

Permalink
Revert "Close socket immediately for fire and forget commands"
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmlee101 authored Jul 11, 2024
1 parent 17268b5 commit 0be5aa3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions BedrockServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2139,12 +2139,14 @@ unique_ptr<BedrockCommand> 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.
Expand Down

0 comments on commit 0be5aa3

Please sign in to comment.