Add reconnect attempts in more cases in QHNCC.

Attempts on:

- QAbstractSocket::ProxyConnectionTimeoutError
- QAbstractSocket::ProxyConnectionClosedError (closed unexpectedly)

Change-Id: I8e85288d724cb2f485f9e61d853dfaac5540032a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Markus Goetz <markus@woboq.com>
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
This commit is contained in:
Azat Khuzhin 2013-05-09 16:43:18 +04:00 committed by The Qt Project
parent d6d9edd7c4
commit e08aca15ec

View File

@ -1171,6 +1171,22 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
case QAbstractSocket::SslHandshakeFailedError:
errorCode = QNetworkReply::SslHandshakeFailedError;
break;
case QAbstractSocket::ProxyConnectionClosedError:
// try to reconnect/resend before sending an error.
if (reconnectAttempts-- > 0) {
closeAndResendCurrentRequest();
return;
}
errorCode = QNetworkReply::ProxyConnectionClosedError;
break;
case QAbstractSocket::ProxyConnectionTimeoutError:
// try to reconnect/resend before sending an error.
if (reconnectAttempts-- > 0) {
closeAndResendCurrentRequest();
return;
}
errorCode = QNetworkReply::ProxyTimeoutError;
break;
default:
// all other errors are treated as NetworkError
errorCode = QNetworkReply::UnknownNetworkError;