diff options
Diffstat (limited to 'app/src/main/java/com/wireguard/android/model/TunnelManager.java')
-rw-r--r-- | app/src/main/java/com/wireguard/android/model/TunnelManager.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/src/main/java/com/wireguard/android/model/TunnelManager.java b/app/src/main/java/com/wireguard/android/model/TunnelManager.java index 381e7f77..61468920 100644 --- a/app/src/main/java/com/wireguard/android/model/TunnelManager.java +++ b/app/src/main/java/com/wireguard/android/model/TunnelManager.java @@ -128,6 +128,15 @@ public final class TunnelManager extends BaseObservable { return tunnels; } + public void refreshTunnelStates() { + asyncWorker.supplyAsync(backend::enumerate) + .thenAccept(running -> { + for (final Tunnel tunnel : tunnels) + tunnel.onStateChanged(running.contains(tunnel.getName()) ? State.UP : State.DOWN); + }) + .whenComplete(ExceptionLoggers.E); + } + public void onCreate() { asyncWorker.supplyAsync(configStore::enumerate) .thenAcceptBoth(asyncWorker.supplyAsync(backend::enumerate), this::onTunnelsLoaded) |