summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorMarkus Goetz <Markus.Goetz@nokia.com>2010-01-11 12:54:35 (GMT)
committerMarkus Goetz <Markus.Goetz@nokia.com>2010-01-11 13:52:18 (GMT)
commit7bd7dabe915df8833601a48de3fee6ad7fac82e9 (patch)
tree198e4b0d61e34a8260095854d5c51fb2319523f1 /src/network
parenta56a9b9d84c40de55255fc58be1ae80cdfaa0c35 (diff)
downloadQt-7bd7dabe915df8833601a48de3fee6ad7fac82e9.zip
Qt-7bd7dabe915df8833601a48de3fee6ad7fac82e9.tar.gz
Qt-7bd7dabe915df8833601a48de3fee6ad7fac82e9.tar.bz2
QNAM HTTP: Check if socket already tries to connect.
This should get rid of QAbstractSocket warnings we sometimes emit. Reviewed-by: Thiago Reviewed-by: Peter Hartmann
Diffstat (limited to 'src/network')
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 7cf632f..b612d26 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -419,15 +419,22 @@ void QHttpNetworkConnectionChannel::_q_receiveReply()
bool QHttpNetworkConnectionChannel::ensureConnection()
{
+ // resend this request after we receive the disconnected signal
+ if (socket->state() == QAbstractSocket::ClosingState) {
+ resendCurrent = true;
+ return false;
+ }
+
+ // already trying to connect?
+ if (socket->state() == QAbstractSocket::HostLookupState ||
+ socket->state() == QAbstractSocket::ConnectingState) {
+ return false;
+ }
+
// make sure that this socket is in a connected state, if not initiate
// connection to the host.
if (socket->state() != QAbstractSocket::ConnectedState) {
// connect to the host if not already connected.
- // resend this request after we receive the disconnected signal
- if (socket->state() == QAbstractSocket::ClosingState) {
- resendCurrent = true;
- return false;
- }
state = QHttpNetworkConnectionChannel::ConnectingState;
pendingEncrypt = connection->d_func()->encrypt;