diff options
author | Maurice Kalinowski <maurice.kalinowski@qt.io> | 2018-01-30 11:40:15 +0100 |
---|---|---|
committer | Maurice Kalinowski <maurice.kalinowski@qt.io> | 2018-02-02 07:59:24 +0000 |
commit | 68fe97befd4a05dad5f3a7efadc299db6ab9a9cf (patch) | |
tree | ccad46dd4c257b2e0a17a1a30050692f32745399 /src/mqtt/qmqttclient.cpp | |
parent | 50a203b7eb245a97a5879979a3d2dea48eacde69 (diff) |
Fix reconnecting after transport error
In case a connection fails due to a transport error, the client must be
able to try to reconnect. Hence, reset the error state when
connectToHost is called. Furthermore the socket needs to be re-created
if it has been instantiated by QMqttClient previously.
Task-number: QTBUG-65726
Change-Id: Id54e5f91a8ca4d0c7be6f51f1ad79e090c681584
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/mqtt/qmqttclient.cpp')
-rw-r--r-- | src/mqtt/qmqttclient.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/mqtt/qmqttclient.cpp b/src/mqtt/qmqttclient.cpp index 29eb4d2..23fb00f 100644 --- a/src/mqtt/qmqttclient.cpp +++ b/src/mqtt/qmqttclient.cpp @@ -419,6 +419,7 @@ void QMqttClient::connectToHost(bool encrypted, const QString &sslPeerName) d->setStateAndError(Disconnected, TransportInvalid); return; } + d->m_error = QMqttClient::NoError; // Fresh reconnect, unset error d->setStateAndError(Connecting); if (d->m_cleanSession) |