From a16de7b03a1b2fe9e5eca55ce677c121e97079f8 Mon Sep 17 00:00:00 2001 From: Grace Kloba Date: Fri, 24 Jul 2009 16:27:11 -0700 Subject: Fix 1993520 where page cycler fails. Recover the old logic before removing network management. Remove the empty list for the host after consuming the last entry. As we should never have an empty list, it is safe to call removeFirst without checking whether it is empty. Currently, in getRequest() or removeFrist(), if we found an empty list, we remove it. Then we return null for the request even there are requests in another list. So the page stops loading until the next getRequest() or removeFirst() is called. If they are not called, those requests will never be accessed. --- core/java/android/net/http/RequestQueue.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'core/java/android/net/http/RequestQueue.java') diff --git a/core/java/android/net/http/RequestQueue.java b/core/java/android/net/http/RequestQueue.java index b6f295e..e14af66 100644 --- a/core/java/android/net/http/RequestQueue.java +++ b/core/java/android/net/http/RequestQueue.java @@ -561,9 +561,8 @@ public class RequestQueue implements RequestFeeder { if (mNetworkConnected && mPending.containsKey(host)) { LinkedList reqList = mPending.get(host); - if (!reqList.isEmpty()) { - ret = reqList.removeFirst(); - } else { + ret = reqList.removeFirst(); + if (reqList.isEmpty()) { mPending.remove(host); } } @@ -624,9 +623,8 @@ public class RequestQueue implements RequestFeeder { if (iter.hasNext()) { Map.Entry> entry = iter.next(); LinkedList reqList = entry.getValue(); - if (!reqList.isEmpty()) { - ret = reqList.removeFirst(); - } else { + ret = reqList.removeFirst(); + if (reqList.isEmpty()) { requestQueue.remove(entry.getKey()); } } -- cgit v1.1