summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author junyulai <junyulai@google.com> 2019-04-25 11:24:04 +0800
committer Junyu Lai <junyulai@google.com> 2019-05-09 17:16:17 +0000
commit5d7bb8b456b2bef8eb177565d283c3b48d9e54fb (patch)
tree4f298a3a628b7d457466f8b9b95f193dcf6c1d7c
parent990053e55216fe854d122727cf1c2d892c19c5f2 (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: Ia30741f71fa72fc117e071976fd73991fa3c9535
-rw-r--r--services/core/java/com/android/server/connectivity/KeepaliveTracker.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/connectivity/KeepaliveTracker.java b/services/core/java/com/android/server/connectivity/KeepaliveTracker.java
index bde430cc297f..84887bdb2dbf 100644
--- a/services/core/java/com/android/server/connectivity/KeepaliveTracker.java
+++ b/services/core/java/com/android/server/connectivity/KeepaliveTracker.java
@@ -496,10 +496,11 @@ 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
- // freed.
}
public void handleStopKeepalive(NetworkAgentInfo nai, int slot, int reason) {