From 422a3c14486f7beeb2297df07ad59159819a33be Mon Sep 17 00:00:00 2001 From: junyulai Date: Wed, 27 Mar 2019 10:31:11 +0800 Subject: [PATCH] Fix keepalive don't get removed when lower layer error Currently, if the lower layer, e.g. wifi, didn't successfully start keepalive by any reason. Due to the startedState changed to NOT_STARTED first, the logic inside stop() will skip the removing process and cause leak. Thus, moving the changing of startedState to proper place first to unblock subsequent changes first. Bug: 123988249 Bug: 129371366 Test: atest FrameworksNetTests Change-Id: I4bba01bacc80e1dac2023ef831b5ade5501894e4 --- .../java/com/android/server/connectivity/KeepaliveTracker.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/connectivity/KeepaliveTracker.java b/services/core/java/com/android/server/connectivity/KeepaliveTracker.java index ce887eb4f0fe1..722c1a0d9a9a8 100644 --- a/services/core/java/com/android/server/connectivity/KeepaliveTracker.java +++ b/services/core/java/com/android/server/connectivity/KeepaliveTracker.java @@ -480,7 +480,6 @@ public class KeepaliveTracker { } } else { // Keepalive successfully stopped, or error. - ki.mStartedState = KeepaliveInfo.NOT_STARTED; if (reason == SUCCESS) { // The message indicated success stopping : don't call handleStopKeepalive. if (DBG) Log.d(TAG, "Successfully stopped keepalive " + slot + " on " + nai.name()); @@ -490,6 +489,7 @@ public class KeepaliveTracker { handleStopKeepalive(nai, slot, reason); if (DBG) Log.d(TAG, "Keepalive " + slot + " on " + nai.name() + " error " + reason); } + ki.mStartedState = KeepaliveInfo.NOT_STARTED; } }