summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Goetz <Markus.Goetz@nokia.com>2009-09-01 15:09:47 (GMT)
committerMarkus Goetz <Markus.Goetz@nokia.com>2009-09-01 15:53:01 (GMT)
commit8ed29668c48dd2a4560ad7a4b0908f3809cbc0df (patch)
tree1c8402585a2c1ef9f70a74a6a180e00d15945aab
parentec4f9047913c07897496e2362e859072c24e8d9f (diff)
downloadQt-8ed29668c48dd2a4560ad7a4b0908f3809cbc0df.zip
Qt-8ed29668c48dd2a4560ad7a4b0908f3809cbc0df.tar.gz
Qt-8ed29668c48dd2a4560ad7a4b0908f3809cbc0df.tar.bz2
QNAM HTTP Code: Removed unnecessary legacy loop
Thank you Coverity! Thank you Biochemist! Reviewed-by: joao
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp39
1 files changed, 16 insertions, 23 deletions
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index da9ec09..bd6fa57 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -425,32 +425,25 @@ void QHttpNetworkConnectionPrivate::dequeueAndSendRequest(QAbstractSocket *socke
int i = indexOf(socket);
if (!highPriorityQueue.isEmpty()) {
- for (int j = highPriorityQueue.count() - 1; j >= 0; --j) {
- HttpMessagePair &messagePair = highPriorityQueue[j];
- if (!messagePair.second->d_func()->requestIsPrepared)
- prepareRequest(messagePair);
-
- channels[i].request = messagePair.first;
- channels[i].reply = messagePair.second;
- // remove before sendRequest! else we might pipeline the same request again
- highPriorityQueue.removeAt(j);
- channels[i].sendRequest();
- return;
- }
+ // remove from queue before sendRequest! else we might pipeline the same request again
+ HttpMessagePair messagePair = highPriorityQueue.takeLast();
+ if (!messagePair.second->d_func()->requestIsPrepared)
+ prepareRequest(messagePair);
+ channels[i].request = messagePair.first;
+ channels[i].reply = messagePair.second;
+ channels[i].sendRequest();
+ return;
}
if (!lowPriorityQueue.isEmpty()) {
- for (int j = lowPriorityQueue.count() - 1; j >= 0; --j) {
- HttpMessagePair &messagePair = lowPriorityQueue[j];
- if (!messagePair.second->d_func()->requestIsPrepared)
- prepareRequest(messagePair);
- channels[i].request = messagePair.first;
- channels[i].reply = messagePair.second;
- // remove before sendRequest! else we might pipeline the same request again
- lowPriorityQueue.removeAt(j);
- channels[i].sendRequest();
- return;
- }
+ // remove from queue before sendRequest! else we might pipeline the same request again
+ HttpMessagePair messagePair = lowPriorityQueue.takeLast();
+ if (!messagePair.second->d_func()->requestIsPrepared)
+ prepareRequest(messagePair);
+ channels[i].request = messagePair.first;
+ channels[i].reply = messagePair.second;
+ channels[i].sendRequest();
+ return;
}
}