From 6cc235e2e983b5995829a90546d0d80230574b4c Mon Sep 17 00:00:00 2001 From: Mikhail Natalenko Date: Tue, 23 Jul 2019 11:16:47 +0300 Subject: [PATCH] Make timeout for cycle definable Signed-off-by: Mikhail Natalenko --- MQTTClient-C/src/MQTTClient.c | 2 +- MQTTClient-C/src/MQTTClient.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/MQTTClient-C/src/MQTTClient.c b/MQTTClient-C/src/MQTTClient.c index bd24dff0..b33bb12f 100755 --- a/MQTTClient-C/src/MQTTClient.c +++ b/MQTTClient-C/src/MQTTClient.c @@ -375,7 +375,7 @@ void MQTTRun(void* parm) #if defined(MQTT_TASK) MutexLock(&c->mutex); #endif - TimerCountdownMS(&timer, 500); /* Don't wait too long if no traffic is incoming */ + TimerCountdownMS(&timer, MQTT_RUN_TIMEOUT); /* Don't wait too long if no traffic is incoming */ cycle(c, &timer); #if defined(MQTT_TASK) MutexUnlock(&c->mutex); diff --git a/MQTTClient-C/src/MQTTClient.h b/MQTTClient-C/src/MQTTClient.h index b612341d..22f5bf08 100755 --- a/MQTTClient-C/src/MQTTClient.h +++ b/MQTTClient-C/src/MQTTClient.h @@ -51,6 +51,9 @@ #define MAX_MESSAGE_HANDLERS 5 /* redefinable - how many subscriptions do you want? */ #endif +#if !defined(MQTT_RUN_TIMEOUT) +#define MQTT_RUN_TIMEOUT 500 +#endif enum QoS { QOS0, QOS1, QOS2, SUBFAIL=0x80 }; /* all failure return codes must be negative */