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.
This commit is contained in:
Tobias Brunner
2014-07-22 10:55:51 +02:00
parent 08d545e29a
commit 394be2d556
2 changed files with 6 additions and 4 deletions
@@ -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();
}
}
}
@@ -313,6 +313,10 @@ public class VpnStateFragment extends Fragment implements VpnStateListener
private void clearError()
{
if (mService != null)
{
mService.disconnect();
}
mDismissedConnectionID = mErrorConnectionID;
updateView();
}