From 024aaeb2012fd40ca7a618e2b7b2cf09f61df285 Mon Sep 17 00:00:00 2001 From: dongyou Date: Mon, 25 Jan 2021 16:50:36 +0800 Subject: [PATCH] fix smartconfig issue when router reply arp late --- components/esp_wifi/src/smartconfig_ack.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/components/esp_wifi/src/smartconfig_ack.c b/components/esp_wifi/src/smartconfig_ack.c index 7dbdb993d5..f5e489568d 100644 --- a/components/esp_wifi/src/smartconfig_ack.c +++ b/components/esp_wifi/src/smartconfig_ack.c @@ -144,20 +144,15 @@ static void sc_ack_send_task(void *pvParameters) vTaskDelay(100 / portTICK_RATE_MS); sendlen = sendto(send_sock, &ack->ctx, ack_len, 0, (struct sockaddr*) &server_addr, sin_size); - if (sendlen > 0) { - /* Totally send 30 smartconfig ACKs. Then smartconfig is successful. */ - if (packet_count++ >= SC_ACK_MAX_COUNT) { - esp_event_post(SC_EVENT, SC_EVENT_SEND_ACK_DONE, NULL, 0, portMAX_DELAY); - goto _end; - } - } - else { + if (sendlen <= 0) { err = sc_ack_send_get_errno(send_sock); - if (err == ENOMEM || err == EAGAIN) { - ESP_LOGD(TAG, "send failed, errno %d", err); - continue; - } - ESP_LOGE(TAG, "send failed, errno %d", err); + ESP_LOGD(TAG, "send failed, errno %d", err); + vTaskDelay(100 / portTICK_RATE_MS); + } + + /* Send 30 smartconfig ACKs. Then smartconfig is successful. */ + if (packet_count++ >= SC_ACK_MAX_COUNT) { + esp_event_post(SC_EVENT, SC_EVENT_SEND_ACK_DONE, NULL, 0, portMAX_DELAY); goto _end; } }