summaryrefslogtreecommitdiffstats
path: root/core/java/android/net/http/RequestQueue.java
diff options
context:
space:
mode:
authorGrace Kloba <klobag@google.com>2009-07-24 16:27:11 -0700
committerGrace Kloba <klobag@google.com>2009-07-24 16:27:11 -0700
commita16de7b03a1b2fe9e5eca55ce677c121e97079f8 (patch)
treef1af5461905dd43e8d897f58f2540ac0d12205c4 /core/java/android/net/http/RequestQueue.java
parentf88c0a0625b136ba26d2e68c692261925a2c9584 (diff)
downloadframeworks_base-a16de7b03a1b2fe9e5eca55ce677c121e97079f8.zip
frameworks_base-a16de7b03a1b2fe9e5eca55ce677c121e97079f8.tar.gz
frameworks_base-a16de7b03a1b2fe9e5eca55ce677c121e97079f8.tar.bz2
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.
Diffstat (limited to 'core/java/android/net/http/RequestQueue.java')
-rw-r--r--core/java/android/net/http/RequestQueue.java10
1 files changed, 4 insertions, 6 deletions
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<Request> 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<HttpHost, LinkedList<Request>> entry = iter.next();
LinkedList<Request> reqList = entry.getValue();
- if (!reqList.isEmpty()) {
- ret = reqList.removeFirst();
- } else {
+ ret = reqList.removeFirst();
+ if (reqList.isEmpty()) {
requestQueue.remove(entry.getKey());
}
}