summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Junyu Lai <junyulai@google.com> 2019-05-09 13:24:32 -0700
committer junyulai <junyulai@google.com> 2019-05-13 18:43:00 +0800
commit8246ca02ab281d8c03bb965105ac2bf8d6c19782 (patch)
tree3eb041e91e5b19ba6ed4f0d4cf4abba197a4799f
parentfd850fd3eb10b2f006ac82e6f6de30c77f4bc9bb (diff)
Clean up the keepalive slots when network disconnect
In general, keepalive slots are released after result of stopping has returned. However, for network disconnect case, the service side cannot communicate with network agent since the async channel is broken. Clean up keepalive slots right after stop in this case. Bug: 132341736 Test: 1. atest com.android.server.ConnectivityServiceTest \ #testNattSocketKeepalives --generate-new-metrics 100 2. atest FrameworksNetTests --generate-new-metrics 10 Change-Id: Id3e4e159713c0ed7e03f45169e87b73ae6408e4f (cherry picked from commit a5f6bd16062fba89bcf900aca93aa3514d93f662) Merged-In: Id3e4e159713c0ed7e03f45169e87b73ae6408e4f Merged-In: Icb5a1b5bb10617aa5a7b35db6cf48db3dc53b7fd
-rw-r--r--services/core/java/com/android/server/connectivity/KeepaliveTracker.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/connectivity/KeepaliveTracker.java b/services/core/java/com/android/server/connectivity/KeepaliveTracker.java
index ae58e994a531..7fb97f28eadc 100644
--- a/services/core/java/com/android/server/connectivity/KeepaliveTracker.java
+++ b/services/core/java/com/android/server/connectivity/KeepaliveTracker.java
@@ -462,6 +462,9 @@ public class KeepaliveTracker {
if (networkKeepalives != null) {
for (KeepaliveInfo ki : networkKeepalives.values()) {
ki.stop(reason);
+ // Clean up keepalives since the network agent is disconnected and unable to pass
+ // back asynchronous result of stop().
+ cleanupStoppedKeepalive(nai, ki.mSlot);
}
}
// Clean up keepalives will be done as a result of calling ki.stop() after the slots are