Merge "Fix VPN retry timer mechanism"

This commit is contained in:
Treehugger Robot
2022-11-03 12:35:12 +00:00
committed by Gerrit Code Review

View File

@@ -2928,7 +2928,6 @@ public class Vpn {
ikeConfiguration.isIkeExtensionEnabled( ikeConfiguration.isIkeExtensionEnabled(
IkeSessionConfiguration.EXTENSION_TYPE_MOBIKE); IkeSessionConfiguration.EXTENSION_TYPE_MOBIKE);
onIkeConnectionInfoChanged(token, ikeConfiguration.getIkeSessionConnectionInfo()); onIkeConnectionInfoChanged(token, ikeConfiguration.getIkeSessionConnectionInfo());
mRetryCount = 0;
} }
/** /**
@@ -3048,6 +3047,7 @@ public class Vpn {
} }
doSendLinkProperties(networkAgent, lp); doSendLinkProperties(networkAgent, lp);
mRetryCount = 0;
} catch (Exception e) { } catch (Exception e) {
Log.d(TAG, "Error in ChildOpened for token " + token, e); Log.d(TAG, "Error in ChildOpened for token " + token, e);
onSessionLost(token, e); onSessionLost(token, e);
@@ -3345,6 +3345,10 @@ public class Vpn {
} }
private void scheduleRetryNewIkeSession() { private void scheduleRetryNewIkeSession() {
if (mScheduledHandleRetryIkeSessionFuture != null) {
Log.d(TAG, "There is a pending retrying task, skip the new retrying task");
return;
}
final long retryDelay = mDeps.getNextRetryDelaySeconds(mRetryCount++); final long retryDelay = mDeps.getNextRetryDelaySeconds(mRetryCount++);
Log.d(TAG, "Retry new IKE session after " + retryDelay + " seconds."); Log.d(TAG, "Retry new IKE session after " + retryDelay + " seconds.");
// If the default network is lost during the retry delay, the mActiveNetwork will be // If the default network is lost during the retry delay, the mActiveNetwork will be