From b3506020d1cc7931067d137b5226734f4c2bd55d Mon Sep 17 00:00:00 2001 From: Dave Besson <101441418+davebesson@users.noreply.github.com> Date: Mon, 29 Aug 2022 11:50:43 -0400 Subject: [PATCH] Update MQTTClient.c Fixed sendPacket() couldn't send packets larger than 2048 bytes and caused a disconnect from server --- Internet/MQTT/MQTTClient.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Internet/MQTT/MQTTClient.c b/Internet/MQTT/MQTTClient.c index 6580aa1..26086c3 100644 --- a/Internet/MQTT/MQTTClient.c +++ b/Internet/MQTT/MQTTClient.c @@ -33,7 +33,7 @@ static int sendPacket(MQTTClient* c, int length, Timer* timer) while (sent < length && !TimerIsExpired(timer)) { - rc = c->ipstack->mqttwrite(c->ipstack, &c->buf[sent], length, TimerLeftMS(timer)); + rc = c->ipstack->mqttwrite(c->ipstack, &c->buf[sent], length - sent, TimerLeftMS(timer)); if (rc < 0) // there was an error writing the data break; sent += rc;