From 734d0562be0bdfdfd88af888b267cbc823d2f8d8 Mon Sep 17 00:00:00 2001 From: Gijs Noorlander Date: Tue, 21 May 2019 20:30:47 +0200 Subject: [PATCH] [PubSubClient] Fix Publish_P return value PR from [PubSubClient PR 600](https://github.com/knolleary/pubsubclient/pull/600) N.B. we had this fix already present in ESPeasy before update to 2.7 --- lib/pubsubclient/src/PubSubClient.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pubsubclient/src/PubSubClient.cpp b/lib/pubsubclient/src/PubSubClient.cpp index 4f8b9b3be..61fa130b5 100644 --- a/lib/pubsubclient/src/PubSubClient.cpp +++ b/lib/pubsubclient/src/PubSubClient.cpp @@ -445,7 +445,9 @@ boolean PubSubClient::publish_P(const char* topic, const uint8_t* payload, unsig lastOutActivity = millis(); - return rc == tlen + 4 + plength; + // Header (1 byte) + llen + identifier (2 bytes) + topic len + payload len + const int expectedLength = 1 + llen + 2 + tlen + plength; + return (rc == expectedLength); } boolean PubSubClient::beginPublish(const char* topic, unsigned int plength, boolean retained) {