diff options
author | Markus Goetz <Markus.Goetz@nokia.com> | 2010-01-11 12:54:35 (GMT) |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2010-01-11 13:52:18 (GMT) |
commit | 7bd7dabe915df8833601a48de3fee6ad7fac82e9 (patch) | |
tree | 198e4b0d61e34a8260095854d5c51fb2319523f1 /src/network | |
parent | a56a9b9d84c40de55255fc58be1ae80cdfaa0c35 (diff) | |
download | Qt-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.cpp | 17 |
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; |