Hello,
Did anyone had an issue when this function is call to clear the queue of sending messages, MCU goes to hard fault?
I think messages are correctly acknowledged, because I can see the status
for(new_head = mqtt_mq_get(mq, 0); new_head >= mq->queue_tail; --new_head) {
if (new_head->state != MQTT_QUEUED_COMPLETE) break;
}
But later when this call happens it hard faults.
I don't know yet, but I seems that
memmove(mqtt_mq_get(mq, new_tail_idx), mq->queue_tail, sizeof(struct mqtt_queued_message) * (size_t) ((new_tail_idx + 1)));
mqtt_mq_get(mq, new_tail_idx) -> this pointer show almost to the end of the send buffer and when memmove is called, size is too big and it overflows.
I don't know if I am doing something wrong, so any help will be appreciated :)
Regards, Jaka