From 77f0d22d38ce188e75147237cc2f4dfff1aab5cb Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 5 May 2010 14:27:12 +0200 Subject: QNAM HTTP: Start more requests in once function call Reviewed-by: Peter Hartmann --- src/network/access/qhttpnetworkconnection.cpp | 28 +++++++++++++-------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 559124f..def4c34 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -716,6 +716,7 @@ void QHttpNetworkConnectionPrivate::removeReply(QHttpNetworkReply *reply) // This function must be called from the event loop. The only // exception is documented in QHttpNetworkConnectionPrivate::queueRequest +// although it is called _q_startNextRequest, it will actually start multiple requests when possible void QHttpNetworkConnectionPrivate::_q_startNextRequest() { //resend the necessary ones. @@ -733,26 +734,23 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest() // dequeue new ones - QAbstractSocket *socket = 0; + // return fast if there is nothing to do + if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty()) + return; + // try to get a free AND connected socket for (int i = 0; i < channelCount; ++i) { - QAbstractSocket *chSocket = channels[i].socket; - // try to get a free AND connected socket if (!channels[i].isSocketBusy() && channels[i].socket->state() == QAbstractSocket::ConnectedState) { - socket = chSocket; - dequeueAndSendRequest(socket); - break; + dequeueAndSendRequest(channels[i].socket); } } - if (!socket) { - for (int i = 0; i < channelCount; ++i) { - QAbstractSocket *chSocket = channels[i].socket; - // try to get a free unconnected socket - if (!channels[i].isSocketBusy()) { - socket = chSocket; - dequeueAndSendRequest(socket); - break; - } + // return fast if there is nothing to do + if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty()) + return; + // try to get a free unconnected socket + for (int i = 0; i < channelCount; ++i) { + if (!channels[i].isSocketBusy()) { + dequeueAndSendRequest(channels[i].socket); } } -- cgit v0.12 From 2479f19ce1df19380dc1fea451b8eb01ab3766dc Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Thu, 29 Apr 2010 06:18:25 +0400 Subject: QHostInfo: Remove unused includes Reviewed-by: Markus Goetz --- src/network/kernel/qhostinfo.cpp | 4 ---- src/network/kernel/qhostinfo_unix.cpp | 1 + src/network/kernel/qhostinfo_win.cpp | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp index 2dd6485..311ee70 100644 --- a/src/network/kernel/qhostinfo.cpp +++ b/src/network/kernel/qhostinfo.cpp @@ -44,14 +44,10 @@ #include "QtCore/qscopedpointer.h" #include -#include #include #include -#include -#include #include #include -#include #include #ifdef Q_OS_UNIX diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp index be06b6e..df98d5d 100644 --- a/src/network/kernel/qhostinfo_unix.cpp +++ b/src/network/kernel/qhostinfo_unix.cpp @@ -44,6 +44,7 @@ #include "qplatformdefs.h" #include "qhostinfo_p.h" +#include "private/qnativesocketengine_p.h" #include "qiodevice.h" #include #include diff --git a/src/network/kernel/qhostinfo_win.cpp b/src/network/kernel/qhostinfo_win.cpp index 4264f60..b30204b 100644 --- a/src/network/kernel/qhostinfo_win.cpp +++ b/src/network/kernel/qhostinfo_win.cpp @@ -50,7 +50,6 @@ #include "private/qnativesocketengine_p.h" #include #include -#include #include #include #include -- cgit v0.12