Skip to content

Commit

Permalink
Merge pull request #172 from MartinKlang/fix/reconnect-init-initialis…
Browse files Browse the repository at this point in the history
…ation

Fix mqtt_init_reconnect initialisation
  • Loading branch information
LiamBindle authored Oct 27, 2022
2 parents 0f4c34c + c7035ed commit 694c21b
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/mqtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ void mqtt_init_reconnect(struct mqtt_client *client,
client->number_of_keep_alives = 0;
client->typical_response_time = -1.0f;
client->publish_response_callback = publish_response_callback;
client->pid_lfsr = 0;
client->send_offset = 0;

client->inspector_callback = NULL;
Expand Down Expand Up @@ -1614,14 +1615,11 @@ ssize_t mqtt_pack_unsubscribe_request(uint8_t *buf, size_t bufsz, unsigned int p
/* MESSAGE QUEUE */
void mqtt_mq_init(struct mqtt_message_queue *mq, void *buf, size_t bufsz)
{
if(buf != NULL)
{
mq->mem_start = buf;
mq->mem_end = (uint8_t *)buf + bufsz;
mq->curr = (uint8_t *)buf;
mq->queue_tail = (struct mqtt_queued_message *)mq->mem_end;
mq->curr_sz = (size_t) (mqtt_mq_currsz(mq));
}
mq->mem_start = buf;
mq->mem_end = (uint8_t *)buf + bufsz;
mq->curr = (uint8_t *)buf;
mq->queue_tail = (struct mqtt_queued_message *)mq->mem_end;
mq->curr_sz = buf == NULL ? 0 : mqtt_mq_currsz(mq);
}

struct mqtt_queued_message* mqtt_mq_register(struct mqtt_message_queue *mq, size_t nbytes)
Expand Down

0 comments on commit 694c21b

Please sign in to comment.