fix: udp 服务端崩溃后无法重启

This commit is contained in:
Ivan Li 2023-04-28 15:40:07 +08:00
parent 101103de03
commit 05660afc54
2 changed files with 4 additions and 1 deletions

View File

@ -1,2 +1,2 @@
idf_component_register(SRCS "service_discovery.c" "app_nvs.c" "apds_9960.c" "pca9555.c" "i2c.c" "asr_pro.c" "ci_03t.c" "ui_input.c" "ambient_light.c" "temperature.c" "embedded_display.c" "mqtt.c" "main.c" "wifi.c" "light.c" "mqtt.c" "led_strip_encoder/led_strip_encoder.c" idf_component_register(SRCS "udp_server.c" "service_discovery.c" "app_nvs.c" "apds_9960.c" "pca9555.c" "i2c.c" "asr_pro.c" "ci_03t.c" "ui_input.c" "ambient_light.c" "temperature.c" "embedded_display.c" "mqtt.c" "main.c" "wifi.c" "light.c" "mqtt.c" "led_strip_encoder/led_strip_encoder.c"
INCLUDE_DIRS ".") INCLUDE_DIRS ".")

View File

@ -10,6 +10,7 @@
#include "esp_wifi.h" #include "esp_wifi.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
#include "light.c"
#include "lwip/err.h" #include "lwip/err.h"
#include "lwip/sockets.h" #include "lwip/sockets.h"
#include "lwip/sys.h" #include "lwip/sys.h"
@ -103,6 +104,8 @@ static void udp_server_task(void *pvParameters) {
ESP_LOGE(UDP_SERVER_TAG, ESP_LOGE(UDP_SERVER_TAG,
"Error occurred during sending: errno %d. sock: %d", errno, "Error occurred during sending: errno %d. sock: %d", errno,
sock); sock);
shutdown(sock, 0);
close(sock);
break; break;
} }
} }