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
|
@Override
|
||||||
public void handle(HttpExchange exchange) {
|
public void handle(HttpExchange exchange) {
|
||||||
if (OperationMode.isInShutdown()) {
|
if (OperationMode.isInShutdown() && !beaconInterface.acceptInShutdown()) {
|
||||||
|
writeError(exchange, new BeaconClientErrorResponse("Daemon is currently in shutdown"), 400);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,10 @@ public abstract class BeaconInterface<T> {
|
||||||
return (Class<T>) Class.forName(name);
|
return (Class<T>) Class.forName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean acceptInShutdown() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean requiresCompletedStartup() {
|
public boolean requiresCompletedStartup() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,11 @@ import java.util.UUID;
|
||||||
|
|
||||||
public class AskpassExchange extends BeaconInterface<AskpassExchange.Request> {
|
public class AskpassExchange extends BeaconInterface<AskpassExchange.Request> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean acceptInShutdown() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPath() {
|
public String getPath() {
|
||||||
return "/askpass";
|
return "/askpass";
|
||||||
|
|
|
@ -11,6 +11,11 @@ import lombok.extern.jackson.Jacksonized;
|
||||||
|
|
||||||
public class HandshakeExchange extends BeaconInterface<HandshakeExchange.Request> {
|
public class HandshakeExchange extends BeaconInterface<HandshakeExchange.Request> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean acceptInShutdown() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPath() {
|
public String getPath() {
|
||||||
return "/handshake";
|
return "/handshake";
|
||||||
|
|
Loading…
Reference in a new issue