mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-21 15:10:23 +00:00
Fix shutdown requests
This commit is contained in:
parent
dd7aa79fc4
commit
40e59ab6a0
4 changed files with 16 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
Loading…
Reference in a new issue