From 57f8effb7d03bf852ac7d88d0cc7ca4ed64ca615 Mon Sep 17 00:00:00 2001 From: tomoaki Date: Tue, 18 May 2021 20:33:38 +0900 Subject: [PATCH] Bugfix of #238 This reverts commit 69fd222d6070a5e9ec02c90b03a7bb0671ca0db0. --- MQTTSNGateway/src/MQTTSNGWPublishHandler.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MQTTSNGateway/src/MQTTSNGWPublishHandler.cpp b/MQTTSNGateway/src/MQTTSNGWPublishHandler.cpp index 9c52028..ebbe8cd 100644 --- a/MQTTSNGateway/src/MQTTSNGWPublishHandler.cpp +++ b/MQTTSNGateway/src/MQTTSNGWPublishHandler.cpp @@ -42,6 +42,7 @@ MQTTGWPacket* MQTTSNPublishHandler::handlePublish(Client* client, int qos; uint8_t retained; uint16_t msgId; + uint16_t tid; uint8_t* payload; MQTTSN_topicid topicid; int payloadlen; @@ -69,6 +70,7 @@ MQTTGWPacket* MQTTSNPublishHandler::handlePublish(Client* client, pub.header.bits.dup = dup; pub.header.bits.qos = (qos == 3 ? 0 : qos); pub.header.bits.retain = retained; + tid = topicid.data.id; Topic* topic = nullptr; @@ -128,7 +130,7 @@ MQTTGWPacket* MQTTSNPublishHandler::handlePublish(Client* client, /* Save a msgId & a TopicId pare for PUBACK */ if (msgId && qos > 0 && qos < 3) { - client->setWaitedPubTopicId(msgId, topicid.data.id, &topicid); + client->setWaitedPubTopicId(msgId, tid, &topicid); } pub.payload = (char*) payload;