From 48821df7bbf11d7d6d595f06743ffc75a9ef7a7d Mon Sep 17 00:00:00 2001 From: Wiebe Cazemier Date: Tue, 5 Nov 2024 20:42:29 +0100 Subject: [PATCH] Fix regression caused by crash fix The fix caused the connack and publish packets of persistent sessions to be sent in the wrong order. --- client.cpp | 1 - threaddata.cpp | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client.cpp b/client.cpp index 191d9e0..2843a7f 100644 --- a/client.cpp +++ b/client.cpp @@ -648,7 +648,6 @@ void Client::sendConnackSuccess() } ConnAck &connAck = *this->stagedConnack.get(); - setAuthenticated(true); MqttPacket response(connAck); writeMqttPacket(response); logger->logf(LOG_NOTICE, "Client '%s' logged in successfully", repr().c_str()); diff --git a/threaddata.cpp b/threaddata.cpp index 1d51224..1733430 100644 --- a/threaddata.cpp +++ b/threaddata.cpp @@ -222,8 +222,9 @@ void ThreadData::continuationOfAuthentication(std::shared_ptr &client, A client->setWillFromStaged(); } - subscriptionStore->registerClientAndKickExistingOne(client); client->sendConnackSuccess(); + subscriptionStore->registerClientAndKickExistingOne(client); + client->setAuthenticated(true); } else // Reauth (to authenticated clients) sends AUTH on success. {