summaryrefslogtreecommitdiffstats
path: root/src/network/access/qhttpnetworkconnectionchannel.cpp
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2017-01-26 13:19:29 +0000
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2017-01-26 16:44:56 +0000
commitaab8e304ea66eaed990d5c53183e9547ce10190b (patch)
tree6dcf944da69a0f8854cbd3d3f5e3641acc4778e3 /src/network/access/qhttpnetworkconnectionchannel.cpp
parent2ccb7ecbca3f27663d96c7582e80c8af18500eda (diff)
Revert "Network (HTTPS): prevent recursion among ->close() methods"
This reverts commit 556b2ee7737b1dfdbc5223e9a1230b5df6843a01. 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>
Diffstat (limited to 'src/network/access/qhttpnetworkconnectionchannel.cpp')
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp44
1 files changed, 21 insertions, 23 deletions
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 094fd36637..668409a988 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -44,7 +44,6 @@
#include <qpair.h>
#include <qdebug.h>
-#include <QScopedValueRollback>
#ifndef QT_NO_HTTP
@@ -197,42 +196,41 @@ void QHttpNetworkConnectionChannel::init()
void QHttpNetworkConnectionChannel::close()
{
- // socket can be 0 since the host lookup is done from qhttpnetworkconnection.cpp while
- // there is no socket yet; we may also clear it, below or in abort, to avoid recursion.
- const bool idle = !socket || socket->state() == QAbstractSocket::UnconnectedState;
- const ChannelState final = idle ? IdleState : ClosingState;
+ if (!socket)
+ state = QHttpNetworkConnectionChannel::IdleState;
+ else if (socket->state() == QAbstractSocket::UnconnectedState)
+ state = QHttpNetworkConnectionChannel::IdleState;
+ else
+ state = QHttpNetworkConnectionChannel::ClosingState;
+
// pendingEncrypt must only be true in between connected and encrypted states
pendingEncrypt = false;
if (socket) {
- QAbstractSocket *const detached = socket;
- QScopedValueRollback<QAbstractSocket *> rollback(socket, nullptr);
- state = final; // Needed during close(), which may over-write it.
- detached->close(); // Error states can cause recursion back to this method.
+ // socket can be 0 since the host lookup is done from qhttpnetworkconnection.cpp while
+ // there is no socket yet.
+ socket->close();
}
-
- // Set state *after* close(), to override any recursive call's idle setting:
- state = final;
}
+
void QHttpNetworkConnectionChannel::abort()
{
- // socket can be 0 since the host lookup is done from qhttpnetworkconnection.cpp while
- // there is no socket yet; we may also clear it, below or in close, to avoid recursion.
- const bool idle = !socket || socket->state() == QAbstractSocket::UnconnectedState;
- const ChannelState final = idle ? IdleState : ClosingState;
+ if (!socket)
+ state = QHttpNetworkConnectionChannel::IdleState;
+ else if (socket->state() == QAbstractSocket::UnconnectedState)
+ state = QHttpNetworkConnectionChannel::IdleState;
+ else
+ state = QHttpNetworkConnectionChannel::ClosingState;
+
// pendingEncrypt must only be true in between connected and encrypted states
pendingEncrypt = false;
if (socket) {
- QAbstractSocket *const detached = socket;
- QScopedValueRollback<QAbstractSocket *> rollback(socket, nullptr);
- state = final;
- detached->abort();
+ // socket can be 0 since the host lookup is done from qhttpnetworkconnection.cpp while
+ // there is no socket yet.
+ socket->abort();
}
-
- // Set state *after* abort(), to override any recursive call's idle setting:
- state = final;
}