From 17fd713bced4f2d00df7ed664ed82a7d108ab317 Mon Sep 17 00:00:00 2001 From: Mikael Kanstrup Date: Thu, 25 Oct 2018 09:50:01 +0200 Subject: [PATCH] Avoid further wait period after reconnect timeout occurs When reconnect timer expires an additional waiting period of half the timeout period is seen. Skip this extra waiting period when timeout is detected and perform the connect attempt right away. This change makes configured reconnect timeout value MQTT_RECONNECT_TIMEOUT_MS accurate. --- mqtt_client.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mqtt_client.c b/mqtt_client.c index bf695f8..fa63fc7 100644 --- a/mqtt_client.c +++ b/mqtt_client.c @@ -845,6 +845,7 @@ static void esp_mqtt_task(void *pv) client->state = MQTT_STATE_INIT; client->reconnect_tick = platform_tick_get_ms(); ESP_LOGD(TAG, "Reconnecting..."); + break; } vTaskDelay(client->wait_timeout_ms / 2 / portTICK_RATE_MS); break;