From 394be2d5563eedf284984f8180e51353af45a621 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Mon, 14 Jul 2014 15:43:06 +0200 Subject: [PATCH] android: Delay disconnecting on errors until user dismisses them If e.g. reauthentication fails we don't want to close the TUN device until the user acknowledged the error and is thus aware of the failure. --- .../src/org/strongswan/android/logic/CharonVpnService.java | 6 ++---- .../src/org/strongswan/android/ui/VpnStateFragment.java | 4 ++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/frontends/android/src/org/strongswan/android/logic/CharonVpnService.java b/src/frontends/android/src/org/strongswan/android/logic/CharonVpnService.java index 13024512e..d53d478b2 100644 --- a/src/frontends/android/src/org/strongswan/android/logic/CharonVpnService.java +++ b/src/frontends/android/src/org/strongswan/android/logic/CharonVpnService.java @@ -322,9 +322,8 @@ public class CharonVpnService extends VpnService implements Runnable } /** - * Set an error on the state service and disconnect the current connection. - * This is not done by calling stopCurrentConnection() above, but instead - * is done asynchronously via state service. + * Set an error on the state service. Called by the handler thread and any + * of charon's threads. * * @param error error state */ @@ -337,7 +336,6 @@ public class CharonVpnService extends VpnService implements Runnable if (!mIsDisconnecting) { mService.setError(error); - mService.disconnect(); } } } diff --git a/src/frontends/android/src/org/strongswan/android/ui/VpnStateFragment.java b/src/frontends/android/src/org/strongswan/android/ui/VpnStateFragment.java index f0a03a513..160ba951b 100644 --- a/src/frontends/android/src/org/strongswan/android/ui/VpnStateFragment.java +++ b/src/frontends/android/src/org/strongswan/android/ui/VpnStateFragment.java @@ -313,6 +313,10 @@ public class VpnStateFragment extends Fragment implements VpnStateListener private void clearError() { + if (mService != null) + { + mService.disconnect(); + } mDismissedConnectionID = mErrorConnectionID; updateView(); }