From 52434f8c0a368f53693c5d091d7b1a3a7839bfd4 Mon Sep 17 00:00:00 2001 From: Jaylin Date: Fri, 4 Feb 2022 15:38:32 +0800 Subject: [PATCH] * FIX [mqtt/protocol] fix #15 --- src/mqtt/protocol/mqtt/mqtt_client.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mqtt/protocol/mqtt/mqtt_client.c b/src/mqtt/protocol/mqtt/mqtt_client.c index 3acada56..ecf6a9fa 100644 --- a/src/mqtt/protocol/mqtt/mqtt_client.c +++ b/src/mqtt/protocol/mqtt/mqtt_client.c @@ -577,9 +577,11 @@ mqtt_recv_cb(void *arg) cached_msg = nni_id_get(&p->recv_unack, packet_id); nni_msg_free(msg); if (cached_msg == NULL) { - nni_plat_printf("ERROR! packet id %d not found", packet_id); + nni_plat_printf("ERROR! packet id %d not found\n", packet_id); break; } + nni_id_remove(&p->recv_unack, packet_id); + printf("##### delete id %d\n", packet_id); if ((ctx = nni_list_first(&s->recv_queue)) == NULL) { // No one waiting to receive yet, putting msg @@ -619,8 +621,10 @@ mqtt_recv_cb(void *arg) nni_aio_finish(user_aio, 0, 0); return; } else { + //TODO check if this packetid already there packet_id = nni_mqtt_msg_get_publish_packet_id(msg); nni_id_set(&p->recv_unack, packet_id, msg); + printf("save id %d\n", packet_id); } break;