diff options
| author | 2023-04-17 11:56:18 +0000 | |
|---|---|---|
| committer | 2023-04-17 11:56:18 +0000 | |
| commit | 0e179fb348ecb44fde168dc3674f164da6aacf1d (patch) | |
| tree | 8af3f52ca1cb3eac07ca4c2a0adab3be18dec545 | |
| parent | 30b6c1965009711175cbd934aadb87b321208780 (diff) | |
| parent | b3f238cdcb1a8e16d4de95ba989f0cc723c65bf2 (diff) | |
Merge "Cleanup : don't mix seconds and milliseconds in retry delays" am: f4abf28623 am: 9aadd136e1 am: b3f238cdcb
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2535344
Change-Id: I77c4b514f09a6c612bdda5323787642cea2394da
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | services/core/java/com/android/server/connectivity/Vpn.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java index 71c4aedea0da..1dc2725feb1b 100644 --- a/services/core/java/com/android/server/connectivity/Vpn.java +++ b/services/core/java/com/android/server/connectivity/Vpn.java @@ -231,7 +231,8 @@ public class Vpn { * <p>If retries have exceeded the length of this array, the last entry in the array will be * used as a repeating interval. */ - private static final long[] IKEV2_VPN_RETRY_DELAYS_SEC = {1L, 2L, 5L, 30L, 60L, 300L, 900L}; + private static final long[] IKEV2_VPN_RETRY_DELAYS_MS = + {1_000L, 2_000L, 5_000L, 30_000L, 60_000L, 300_000L, 900_000L}; /** * A constant to pass to {@link IkeV2VpnRunner#scheduleStartIkeSession(long)} to mean the @@ -647,14 +648,14 @@ public class Vpn { /** * Retrieves the next retry delay * - * <p>If retries have exceeded the IKEV2_VPN_RETRY_DELAYS_SEC, the last entry in + * <p>If retries have exceeded the size of IKEV2_VPN_RETRY_DELAYS_MS, the last entry in * the array will be used as a repeating interval. */ - public long getNextRetryDelaySeconds(int retryCount) { - if (retryCount >= IKEV2_VPN_RETRY_DELAYS_SEC.length) { - return IKEV2_VPN_RETRY_DELAYS_SEC[IKEV2_VPN_RETRY_DELAYS_SEC.length - 1]; + public long getNextRetryDelayMs(int retryCount) { + if (retryCount >= IKEV2_VPN_RETRY_DELAYS_MS.length) { + return IKEV2_VPN_RETRY_DELAYS_MS[IKEV2_VPN_RETRY_DELAYS_MS.length - 1]; } else { - return IKEV2_VPN_RETRY_DELAYS_SEC[retryCount]; + return IKEV2_VPN_RETRY_DELAYS_MS[retryCount]; } } @@ -3782,7 +3783,7 @@ public class Vpn { } final long retryDelayMs = RETRY_DELAY_AUTO_BACKOFF != delayMs ? delayMs - : mDeps.getNextRetryDelaySeconds(mRetryCount++) * 1000; + : mDeps.getNextRetryDelayMs(mRetryCount++); Log.d(TAG, "Retry new IKE session after " + retryDelayMs + " milliseconds."); // If the default network is lost during the retry delay, the mActiveNetwork will be // null, and the new IKE session won't be established until there is a new default |