diff options
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qnetworkaccessmanager.cpp | 2 | ||||
-rw-r--r-- | src/network/access/qnetworkreplyimpl.cpp | 10 | ||||
-rw-r--r-- | src/network/access/qnetworkreplyimpl_p.h | 2 | ||||
-rw-r--r-- | src/network/bearer/qnetworksession.cpp | 9 | ||||
-rw-r--r-- | src/network/bearer/qnetworksession_p.h | 4 |
5 files changed, 19 insertions, 8 deletions
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 51c5731..f52eec5 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -914,6 +914,8 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera if (req.url().scheme() != QLatin1String("file") && !req.url().scheme().isEmpty()) { connect(this, SIGNAL(networkSessionConnected()), reply, SLOT(_q_networkSessionConnected())); + if (d->networkSession) + connect(d->networkSession, SIGNAL(closed()), reply, SLOT(_q_networkSessionClosed())); } QNetworkReplyImplPrivate *priv = reply->d_func(); priv->manager = this; diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 7fc0097..9ef2ed8 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -262,6 +262,16 @@ void QNetworkReplyImplPrivate::_q_networkSessionConnected() } } +void QNetworkReplyImplPrivate::_q_networkSessionClosed() +{ + if (state != Finished) { + state = Working; + error(QNetworkReply::UnknownNetworkError, + QCoreApplication::translate("QNetworkReply", "Network session closed.")); + finished(); + } +} + void QNetworkReplyImplPrivate::_q_networkSessionFailed() { // Abort waiting replies. diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index fcb3397..8e498d5 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -100,6 +100,7 @@ public: Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingData()) Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingDataFinished()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionConnected()) + Q_PRIVATE_SLOT(d_func(), void _q_networkSessionClosed()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionFailed()) }; @@ -134,6 +135,7 @@ public: void _q_bufferOutgoingData(); void _q_bufferOutgoingDataFinished(); void _q_networkSessionConnected(); + void _q_networkSessionClosed(); void _q_networkSessionFailed(); void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request, diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index cf9f4b2..d05f20e 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -231,7 +231,7 @@ QNetworkSession::QNetworkSession(const QNetworkConfiguration& connectionConfig, d->q = this; d->publicConfig = connectionConfig; d->syncStateWithInterface(); - connect(d, SIGNAL(quitPendingWaitsForOpened()), this, SIGNAL(opened())); + connect(d, SIGNAL(opened()), this, SIGNAL(opened())); connect(d, SIGNAL(error(QNetworkSession::SessionError)), this, SIGNAL(error(QNetworkSession::SessionError))); connect(d, SIGNAL(stateChanged(QNetworkSession::State)), @@ -308,10 +308,9 @@ bool QNetworkSession::waitForOpened(int msecs) return false; QEventLoop* loop = new QEventLoop(this); - QObject::connect(d, SIGNAL(quitPendingWaitsForOpened()), - loop, SLOT(quit())); - QObject::connect(this, SIGNAL(error(QNetworkSession::SessionError)), - loop, SLOT(quit())); + connect(d, SIGNAL(opened()), loop, SLOT(quit())); + connect(d, SIGNAL(closed()), loop, SLOT(quit())); + connect(d, SIGNAL(error(QNetworkSession::SessionError)), loop, SLOT(quit())); //final call if (msecs>=0) diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h index 76691b3..5eef8e3 100644 --- a/src/network/bearer/qnetworksession_p.h +++ b/src/network/bearer/qnetworksession_p.h @@ -116,9 +116,7 @@ protected: } Q_SIGNALS: - //releases any pending waitForOpened() calls - void quitPendingWaitsForOpened(); - + void opened(); void error(QNetworkSession::SessionError error); void stateChanged(QNetworkSession::State state); void closed(); |