Skip to content

Commit

Permalink
Fix for read of fixed portion (2 bytes) of header when only 1 is retu…
Browse files Browse the repository at this point in the history
…rned.
  • Loading branch information
dgarske committed Nov 21, 2023
1 parent 052656c commit 60bdf1a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/mqtt_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,8 @@ static int MqttClient_WaitType(MqttClient *client, void *packet_obj,
if (rc <= 0) {
#ifdef WOLFMQTT_NONBLOCK
if (rc == MQTT_CODE_CONTINUE &&
client->packet.stat > MQTT_PK_BEGIN) {
(client->packet.stat > MQTT_PK_BEGIN ||
client->read.total > 0)) {
/* advance state, since we received some data */
mms_stat->read = MQTT_MSG_HEADER;
}
Expand Down
1 change: 0 additions & 1 deletion src/mqtt_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1963,7 +1963,6 @@ int MqttPacket_Read(MqttClient *client, byte* rx_buf, int rx_buf_len,
{
case MQTT_PK_BEGIN:
{
client->read.pos = 0;
client->packet.header_len = MQTT_PACKET_HEADER_MIN_SIZE;
client->packet.remain_len = 0;

Expand Down

0 comments on commit 60bdf1a

Please sign in to comment.