Skip to content

Commit 2adb215

Browse files
committed
fix : fix msg handler not destroy when unsubscribe.
1 parent 887fad4 commit 2adb215

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mqttclient/mqttclient.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @Author: jiejie
33
* @Github: https://github.com/jiejieTop
44
* @Date: 2019-12-09 21:31:25
5-
* @LastEditTime: 2020-11-05 16:02:47
5+
* @LastEditTime: 2021-01-14 10:00:12
66
* @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
77
*/
88
#include "mqttclient.h"
@@ -1360,8 +1360,8 @@ int mqtt_unsubscribe(mqtt_client_t* c, const char* topic_filter)
13601360
if ((rc = mqtt_send_packet(c, len, &timer)) != MQTT_SUCCESS_ERROR)
13611361
goto exit;
13621362

1363-
/* create a message and record it */
1364-
msg_handler = mqtt_msg_handler_create((const char*)topic_filter, QOS0, NULL);
1363+
/* get a already subscribed message handler */
1364+
msg_handler = mqtt_get_msg_handler(c, &topic);
13651365
if (NULL == msg_handler) {
13661366
rc = MQTT_MEM_NOT_ENOUGH_ERROR;
13671367
goto exit;

0 commit comments

Comments
 (0)