Преглед изворни кода

fix smartconfig issue when router reply arp late

dongyou пре 5 година
родитељ
комит
c505fe650f
1 измењених фајлова са 13 додато и 17 уклоњено
  1. 13 17
      components/smartconfig_ack/smartconfig_ack.c

+ 13 - 17
components/smartconfig_ack/smartconfig_ack.c

@@ -118,25 +118,21 @@ 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) {
-                        if (ack->link_flag) {
-                            *ack->link_flag = 1;
-                        }
-                        if (ack->cb) {
-                            ack->cb(SC_STATUS_LINK_OVER, remote_ip);
-                        }
-                        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_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) {
+                    if (ack->link_flag) {
+                        *ack->link_flag = 1;
+                    }
+                    if (ack->cb) {
+                        ack->cb(SC_STATUS_LINK_OVER, remote_ip);
                     }
-                    ESP_LOGE(TAG, "send failed, errno %d", err);
                     goto _end;
                 }
             }