From 146d0de1d41df1171487429b777594e91f56cadc Mon Sep 17 00:00:00 2001 From: hsaturn Date: Sun, 4 Apr 2021 06:35:50 +0200 Subject: [PATCH] MqttClient: bug fix, connection lost at each publish received --- src/TinyMqtt.cpp | 5 ----- src/TinyMqtt.h | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/TinyMqtt.cpp b/src/TinyMqtt.cpp index b24d1ef..24fb984 100644 --- a/src/TinyMqtt.cpp +++ b/src/TinyMqtt.cpp @@ -499,11 +499,6 @@ if (mesg->type() != MqttMessage::Type::PingReq && mesg->type() != MqttMessage::T if (callback and isSubscribedTo(published)) { callback(this, published, payload, len); // TODO send the real payload - - mesg->changeType(MqttMessage::Type::PubAck); // TODO constness design but saves memory & speed - // TODO re-add packet identifier if any - mesg->sendTo(this); - mesg->changeType(MqttMessage::Type::Publish); // mesg is const (...) } } else if (parent) // from outside to inside diff --git a/src/TinyMqtt.h b/src/TinyMqtt.h index 6119bae..723d24e 100644 --- a/src/TinyMqtt.h +++ b/src/TinyMqtt.h @@ -145,7 +145,7 @@ class MqttClient { if (client) client->write(buf, length); } const std::string& id() const { return clientId; } - // void id(std::string& new_id) { clientId = new_id; } + void id(std::string& new_id) { clientId = new_id; } /** Should be called in main loop() */ void loop();