TunnelManager: Clear primary tunnel when it's removed
Signed-off-by: Samuel Holland <samuel@sholland.org>
This commit is contained in:
parent
609194fae2
commit
58eedfd6d9
@ -70,7 +70,11 @@ public final class TunnelManager {
|
|||||||
Log.v(TAG, "Requested delete tunnel " + tunnel.getName() + " state=" + tunnel.getState());
|
Log.v(TAG, "Requested delete tunnel " + tunnel.getName() + " state=" + tunnel.getState());
|
||||||
return backend.setState(tunnel, State.DOWN)
|
return backend.setState(tunnel, State.DOWN)
|
||||||
.thenCompose(x -> configStore.delete(tunnel.getName()))
|
.thenCompose(x -> configStore.delete(tunnel.getName()))
|
||||||
.thenAccept(x -> tunnels.remove(tunnel.getName()));
|
.thenAccept(x -> {
|
||||||
|
tunnels.remove(tunnel.getName());
|
||||||
|
if (tunnel.getName().equals(preferences.getString(KEY_PRIMARY_TUNNEL, null)))
|
||||||
|
preferences.edit().remove(KEY_PRIMARY_TUNNEL).apply();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public TunnelCollection getTunnels() {
|
public TunnelCollection getTunnels() {
|
||||||
|
Loading…
Reference in New Issue
Block a user