Tunnel: Remove UNKNOWN state
It's never used. Signed-off-by: Samuel Holland <samuel@sholland.org>
This commit is contained in:
@@ -35,8 +35,6 @@ public final class WgQuickBackend implements Backend {
|
||||
}
|
||||
|
||||
private static State resolveState(final State currentState, State requestedState) {
|
||||
if (requestedState == State.UNKNOWN)
|
||||
throw new IllegalArgumentException("Requested unknown state");
|
||||
if (requestedState == State.TOGGLE)
|
||||
requestedState = currentState == State.UP ? State.DOWN : State.UP;
|
||||
return requestedState;
|
||||
|
||||
@@ -69,15 +69,11 @@ public class Tunnel extends BaseObservable implements Keyed<String> {
|
||||
|
||||
@Bindable
|
||||
public State getState() {
|
||||
if (state == State.UNKNOWN)
|
||||
manager.getTunnelState(this).whenComplete(ExceptionLoggers.E);
|
||||
return state;
|
||||
}
|
||||
|
||||
public CompletionStage<State> getStateAsync() {
|
||||
if (state == State.UNKNOWN)
|
||||
return manager.getTunnelState(this);
|
||||
return CompletableFuture.completedFuture(state);
|
||||
return manager.getTunnelState(this);
|
||||
}
|
||||
|
||||
@Bindable
|
||||
@@ -133,7 +129,6 @@ public class Tunnel extends BaseObservable implements Keyed<String> {
|
||||
public enum State {
|
||||
DOWN,
|
||||
TOGGLE,
|
||||
UNKNOWN,
|
||||
UP
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user