summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaurice Kalinowski <maurice.kalinowski@qt.io>2018-11-15 08:28:47 +0100
committerMaurice Kalinowski <maurice.kalinowski@qt.io>2018-11-15 10:04:39 +0000
commit4a239e34c7f191ba69211d2a8aa369452dedb93f (patch)
tree051eef033aabb5b77ef395198831171b583ef6f7
parent4a8f8f99c82482a679c6e1b0ee5bc377899f68d0 (diff)
Reject connection request while in connecting state
Otherwise might lead to side effects. Task-number: QTBUG-71795 Change-Id: Iad2cbe7613e08d1f90f497d1d65ed2da924f0aeb Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
-rw-r--r--src/mqtt/qmqttclient.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mqtt/qmqttclient.cpp b/src/mqtt/qmqttclient.cpp
index fd6ca5d..0ea0f1e 100644
--- a/src/mqtt/qmqttclient.cpp
+++ b/src/mqtt/qmqttclient.cpp
@@ -521,6 +521,11 @@ void QMqttClient::connectToHost(bool encrypted, const QString &sslPeerName)
{
Q_D(QMqttClient);
+ if (state() == QMqttClient::Connecting) {
+ qCDebug(lcMqttClient) << "Connection request currently ongoing.";
+ return;
+ }
+
if (state() == QMqttClient::Connected) {
qCDebug(lcMqttClient) << "Already connected to a broker. Rejecting connection request.";
return;