diff options
author | Maurice Kalinowski <maurice.kalinowski@qt.io> | 2017-11-14 07:21:46 +0100 |
---|---|---|
committer | Maurice Kalinowski <maurice.kalinowski@qt.io> | 2017-11-15 14:06:41 +0000 |
commit | 6b6d2749e6107a77390cc67572e86294115350a2 (patch) | |
tree | 980d73648c3210741bf4f951568d5203c5b495a3 /src/mqtt/qmqttclient.cpp | |
parent | 42c9128e48c8ec66dd8affd53d8e0513427c75a3 (diff) |
Fix subscriptions at reconnectv1.0
When a client reconnects with a cleanSession, all previous subscriptions
need to be disabled due to not being valid anymore. Furthermore, a
broker can decide to not restore a session even though cleanSession was
false. Take this into account by disabling existing subscriptions in
that case as well.
Task-number: QTBUG-64042
Change-Id: I618bc1fe4bb30651a34d70ec9d9e95e48b1c25d5
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/mqtt/qmqttclient.cpp')
-rw-r--r-- | src/mqtt/qmqttclient.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mqtt/qmqttclient.cpp b/src/mqtt/qmqttclient.cpp index 22ee311..a765f60 100644 --- a/src/mqtt/qmqttclient.cpp +++ b/src/mqtt/qmqttclient.cpp @@ -421,6 +421,9 @@ void QMqttClient::connectToHost(bool encrypted, const QString &sslPeerName) } d->setStateAndError(Connecting); + if (d->m_cleanSession) + d->m_connection.cleanSubscriptions(); + if (!d->m_connection.ensureTransportOpen(sslPeerName)) { qWarning("Could not ensure that connection is open"); d->setStateAndError(Disconnected, TransportInvalid); |