Fix shutdown requests

This commit is contained in:
crschnick 2024-08-09 07:00:29 +00:00
parent dd7aa79fc4
commit 40e59ab6a0
4 changed files with 16 additions and 1 deletions

View file

@ -28,7 +28,8 @@ public class BeaconRequestHandler<T> implements HttpHandler {
@Override
public void handle(HttpExchange exchange) {
if (OperationMode.isInShutdown()) {
if (OperationMode.isInShutdown() && !beaconInterface.acceptInShutdown()) {
writeError(exchange, new BeaconClientErrorResponse("Daemon is currently in shutdown"), 400);
return;
}

View file

@ -62,6 +62,10 @@ public abstract class BeaconInterface<T> {
return (Class<T>) Class.forName(name);
}
public boolean acceptInShutdown() {
return false;
}
public boolean requiresCompletedStartup() {
return true;
}

View file

@ -12,6 +12,11 @@ import java.util.UUID;
public class AskpassExchange extends BeaconInterface<AskpassExchange.Request> {
@Override
public boolean acceptInShutdown() {
return true;
}
@Override
public String getPath() {
return "/askpass";

View file

@ -11,6 +11,11 @@ import lombok.extern.jackson.Jacksonized;
public class HandshakeExchange extends BeaconInterface<HandshakeExchange.Request> {
@Override
public boolean acceptInShutdown() {
return true;
}
@Override
public String getPath() {
return "/handshake";