From 2afdad609311b70b19761e994789e024b098916c Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 27 May 2025 11:53:49 -0500 Subject: [PATCH] 8266 --- esphome/core/application.cpp | 8 ++++---- esphome/core/application.h | 8 +------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/esphome/core/application.cpp b/esphome/core/application.cpp index eb0fba7579..c37d9c1a0f 100644 --- a/esphome/core/application.cpp +++ b/esphome/core/application.cpp @@ -7,7 +7,7 @@ #include "esphome/components/status_led/status_led.h" #endif -#ifdef FD_SETSIZE +#if defined(FD_SETSIZE) && !defined(USE_SOCKET_IMPL_LWIP_TCP) #include #ifdef USE_ESP32 #include @@ -122,7 +122,7 @@ void Application::loop() { next_schedule = std::max(next_schedule, delay_time / 2); delay_time = std::min(next_schedule, delay_time); -#ifdef FD_SETSIZE +#if defined(FD_SETSIZE) && !defined(USE_SOCKET_IMPL_LWIP_TCP) if (!this->socket_fds_.empty()) { // Use select() with timeout when we have sockets to monitor @@ -238,7 +238,7 @@ bool Application::register_socket_fd(int fd) { if (fd < 0) return false; -#ifdef FD_SETSIZE +#if defined(FD_SETSIZE) && !defined(USE_SOCKET_IMPL_LWIP_TCP) if (fd >= FD_SETSIZE) { ESP_LOGE(TAG, "Cannot monitor socket fd %d: exceeds FD_SETSIZE (%d)", fd, FD_SETSIZE); ESP_LOGE(TAG, "Socket will not be monitored for data - may cause performance issues!"); @@ -277,7 +277,7 @@ bool Application::is_socket_ready(int fd) const { // This function is thread-safe for reading the result of select() // However, it should only be called after select() has been executed in the main loop // The read_fds_ is only modified by select() in the main loop -#ifdef FD_SETSIZE +#if defined(FD_SETSIZE) && !defined(USE_SOCKET_IMPL_LWIP_TCP) if (fd < 0 || fd >= FD_SETSIZE) return false; diff --git a/esphome/core/application.h b/esphome/core/application.h index f2774db274..5818ea7c79 100644 --- a/esphome/core/application.h +++ b/esphome/core/application.h @@ -74,12 +74,6 @@ #include "esphome/components/update/update_entity.h" #endif -#ifdef USE_BSD_SOCKETS -#include -#elif defined(USE_LWIP_SOCKETS) || defined(USE_SOCKET_IMPL_LWIP_SOCKETS) -#include "lwip/sockets.h" -#endif - namespace esphome { class Application { @@ -578,7 +572,7 @@ class Application { std::set socket_fds_; // Set of all monitored socket file descriptors bool socket_fds_changed_{false}; // Flag to rebuild base_read_fds_ when socket_fds_ changes int max_fd_{-1}; // Highest file descriptor number for select() -#ifdef FD_SETSIZE +#if defined(FD_SETSIZE) && !defined(USE_SOCKET_IMPL_LWIP_TCP) fd_set base_read_fds_{}; // Cached fd_set rebuilt only when socket_fds_ changes fd_set read_fds_{}; // Working fd_set for select(), copied from base_read_fds_ #endif