Revert "Network (HTTPS): prevent recursion among ->close() methods"
This reverts commit 556b2ee773
.
The reason for this is that this change appears to stop
QtLocation from fetching tiles.
Task-number: QTBUG-58303
Change-Id: I64cd3a17d24f10652bb68cee0267cc7ff1f9d479
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
2ccb7ecbca
commit
aab8e304ea
@ -44,7 +44,6 @@
|
|||||||
|
|
||||||
#include <qpair.h>
|
#include <qpair.h>
|
||||||
#include <qdebug.h>
|
#include <qdebug.h>
|
||||||
#include <QScopedValueRollback>
|
|
||||||
|
|
||||||
#ifndef QT_NO_HTTP
|
#ifndef QT_NO_HTTP
|
||||||
|
|
||||||
@ -197,42 +196,41 @@ void QHttpNetworkConnectionChannel::init()
|
|||||||
|
|
||||||
void QHttpNetworkConnectionChannel::close()
|
void QHttpNetworkConnectionChannel::close()
|
||||||
{
|
{
|
||||||
// socket can be 0 since the host lookup is done from qhttpnetworkconnection.cpp while
|
if (!socket)
|
||||||
// there is no socket yet; we may also clear it, below or in abort, to avoid recursion.
|
state = QHttpNetworkConnectionChannel::IdleState;
|
||||||
const bool idle = !socket || socket->state() == QAbstractSocket::UnconnectedState;
|
else if (socket->state() == QAbstractSocket::UnconnectedState)
|
||||||
const ChannelState final = idle ? IdleState : ClosingState;
|
state = QHttpNetworkConnectionChannel::IdleState;
|
||||||
|
else
|
||||||
|
state = QHttpNetworkConnectionChannel::ClosingState;
|
||||||
|
|
||||||
// pendingEncrypt must only be true in between connected and encrypted states
|
// pendingEncrypt must only be true in between connected and encrypted states
|
||||||
pendingEncrypt = false;
|
pendingEncrypt = false;
|
||||||
|
|
||||||
if (socket) {
|
if (socket) {
|
||||||
QAbstractSocket *const detached = socket;
|
// socket can be 0 since the host lookup is done from qhttpnetworkconnection.cpp while
|
||||||
QScopedValueRollback<QAbstractSocket *> rollback(socket, nullptr);
|
// there is no socket yet.
|
||||||
state = final; // Needed during close(), which may over-write it.
|
socket->close();
|
||||||
detached->close(); // Error states can cause recursion back to this method.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set state *after* close(), to override any recursive call's idle setting:
|
|
||||||
state = final;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QHttpNetworkConnectionChannel::abort()
|
void QHttpNetworkConnectionChannel::abort()
|
||||||
{
|
{
|
||||||
// socket can be 0 since the host lookup is done from qhttpnetworkconnection.cpp while
|
if (!socket)
|
||||||
// there is no socket yet; we may also clear it, below or in close, to avoid recursion.
|
state = QHttpNetworkConnectionChannel::IdleState;
|
||||||
const bool idle = !socket || socket->state() == QAbstractSocket::UnconnectedState;
|
else if (socket->state() == QAbstractSocket::UnconnectedState)
|
||||||
const ChannelState final = idle ? IdleState : ClosingState;
|
state = QHttpNetworkConnectionChannel::IdleState;
|
||||||
|
else
|
||||||
|
state = QHttpNetworkConnectionChannel::ClosingState;
|
||||||
|
|
||||||
// pendingEncrypt must only be true in between connected and encrypted states
|
// pendingEncrypt must only be true in between connected and encrypted states
|
||||||
pendingEncrypt = false;
|
pendingEncrypt = false;
|
||||||
|
|
||||||
if (socket) {
|
if (socket) {
|
||||||
QAbstractSocket *const detached = socket;
|
// socket can be 0 since the host lookup is done from qhttpnetworkconnection.cpp while
|
||||||
QScopedValueRollback<QAbstractSocket *> rollback(socket, nullptr);
|
// there is no socket yet.
|
||||||
state = final;
|
socket->abort();
|
||||||
detached->abort();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set state *after* abort(), to override any recursive call's idle setting:
|
|
||||||
state = final;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user