Fix QNetworkReplyImpl error handling

The backend was never started when compiled without bearer management,
now it is.
Now emits the error signal in case of startup errors which would leave
the state machine hanging. Previously it just printed a warning.

Reviewed-by: Peter Hartmann
This commit is contained in:
Shane Kearns 2011-04-18 15:30:39 +01:00 committed by Markus Goetz
parent 1ad3814a56
commit a342ba933a

View File

@ -89,10 +89,10 @@ void QNetworkReplyImplPrivate::_q_startOperation()
return;
}
if (!backend->start()) {
#ifndef QT_NO_BEARERMANAGEMENT
if (!backend->start()) { // ### we should call that method even if bearer is not used
// backend failed to start because the session state is not Connected.
// QNetworkAccessManager will call reply->backend->start() again for us when the session
// QNetworkAccessManager will call _q_startOperation again for us when the session
// state changes.
state = WaitingForSession;
@ -108,11 +108,20 @@ void QNetworkReplyImplPrivate::_q_startOperation()
session->open();
} else {
qWarning("Backend is waiting for QNetworkSession to connect, but there is none!");
state = Working;
error(QNetworkReplyImpl::UnknownNetworkError,
QCoreApplication::translate("QNetworkReply", "Network session error."));
finished();
}
#else
qWarning("Backend start failed");
state = Working;
error(QNetworkReplyImpl::UnknownNetworkError,
QCoreApplication::translate("QNetworkReply", "backend start error."));
finished();
#endif
return;
}
#endif
if (backend && backend->isSynchronous()) {
state = Finished;