Skip to content

Commit d787a26

Browse files
committed
fix: mqtt recv cycle feed watchdog when cycle interval is 0
Send cycle and recv cycle share one mutex, For increasing mqtt thoughtput, set receive cycle to 0, mqtt recv cycle feed watchdog when cycle interval=0
1 parent bf27e59 commit d787a26

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

components/mqtt/paho/MQTTClient-C/src/MQTTClient.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <stdio.h>
1919
#include <string.h>
2020
#include "esp_log.h"
21+
#include "esp_task_wdt.h"
2122
#include "MQTTClient.h"
2223

2324
static const char *TAG = "mc";
@@ -438,6 +439,10 @@ void MQTTRun(void *parm)
438439
while (1) {
439440
TimerCountdownMS(&timer, CONFIG_MQTT_RECV_CYCLE); /* Don't wait too long if no traffic is incoming */
440441

442+
#if CONFIG_MQTT_RECV_CYCLE == 0 /* The smaller cycle, the greater throughput */
443+
esp_task_wdt_reset();
444+
#endif
445+
441446
#if defined(MQTT_TASK)
442447
MutexLock(&c->mutex);
443448
#endif

0 commit comments

Comments
 (0)