From 9c2ecf89eb773b4929d39a0a4929ce2b647aaaef Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Wed, 26 Mar 2014 09:40:52 -0400 Subject: network: finish all pending replies upon error ... and not only one. This was a problem e.g. when there were several requests to the same host and the host was not reachable; only one reply would get an error signal in case we suppressed other errors in "happy eyeballs" host lookup style. Task-number: QTBUG-36890 Change-Id: I1b5757498bd644b0d773cf6c43e4950620949c5c Reviewed-by: Richard J. Moore --- .../access/qhttpnetworkconnectionchannel.cpp | 27 +++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index fb40958178..169124e9f4 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -873,18 +873,23 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket if (!connection->d_func()->shouldEmitChannelError(socket)) return; - // Need to dequeu the request so that we can emit the error. - if (!reply) - connection->d_func()->dequeueRequest(socket); - if (reply) { - reply->d_func()->errorString = errorString; - emit reply->finishedWithError(errorCode, errorString); - reply = 0; - if (protocolHandler) - protocolHandler->setReply(0); - } + // emit error for all waiting replies + do { + // Need to dequeu the request so that we can emit the error. + if (!reply) + connection->d_func()->dequeueRequest(socket); + + if (reply) { + reply->d_func()->errorString = errorString; + emit reply->finishedWithError(errorCode, errorString); + reply = 0; + if (protocolHandler) + protocolHandler->setReply(0); + } + } while (!connection->d_func()->highPriorityQueue.isEmpty() + || !connection->d_func()->lowPriorityQueue.isEmpty()); #ifndef QT_NO_SSL - else if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY) { + if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY) { QList spdyPairs = spdyRequestsToSend.values(); for (int a = 0; a < spdyPairs.count(); ++a) { // emit error for all replies -- cgit v1.2.3