From b91368594db34932dc3d54f74f9fde1e2d6096c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Str=C3=B6m?= Date: Mon, 6 Dec 2021 13:38:48 +0100 Subject: [PATCH] MQTT: trigger conn failure callback if DNS success but connection failed (#3477) --- app/modules/mqtt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/modules/mqtt.c b/app/modules/mqtt.c index 32119573..5519908e 100644 --- a/app/modules/mqtt.c +++ b/app/modules/mqtt.c @@ -1021,7 +1021,12 @@ static void socket_dns_found(const char *name, ip_addr_t *ipaddr, void *arg) NODE_DBG(IPSTR, IP2STR(&(ipaddr->addr))); NODE_DBG("\n"); - mqtt_socket_do_connect(mud); + if(mqtt_socket_do_connect(mud) != ESPCONN_OK) { + NODE_DBG("socket_dns_found, got DNS but connect failed\n"); + mqtt_connack_fail(mud, MQTT_CONN_FAIL_DNS); + mqtt_socket_disconnected(arg); + return; + } } #include "pm/swtimer.h"