diff --git a/esphome/core/application.cpp b/esphome/core/application.cpp index 3f9569f724..302bfa4880 100644 --- a/esphome/core/application.cpp +++ b/esphome/core/application.cpp @@ -7,7 +7,7 @@ #include "esphome/components/status_led/status_led.h" #endif -#if defined(FD_SETSIZE) && !defined(USE_SOCKET_IMPL_LWIP_TCP) +#if (defined(USE_SOCKET_IMPL_LWIP_SOCKETS) || defined(USE_SOCKET_IMPL_BSD_SOCKETS)) && defined(FD_SETSIZE) #include #ifdef USE_ESP32 // ESP32 with BSD sockets actually uses lwIP underneath @@ -129,7 +129,7 @@ void Application::loop() { next_schedule = std::max(next_schedule, delay_time / 2); delay_time = std::min(next_schedule, delay_time); -#if defined(FD_SETSIZE) && !defined(USE_SOCKET_IMPL_LWIP_TCP) +#if (defined(USE_SOCKET_IMPL_LWIP_SOCKETS) || defined(USE_SOCKET_IMPL_BSD_SOCKETS)) && defined(FD_SETSIZE) if (!this->socket_fds_.empty()) { // Use select() with timeout when we have sockets to monitor @@ -253,7 +253,7 @@ bool Application::register_socket_fd(int fd) { if (fd < 0) return false; -#if defined(FD_SETSIZE) && !defined(USE_SOCKET_IMPL_LWIP_TCP) +#if (defined(USE_SOCKET_IMPL_LWIP_SOCKETS) || defined(USE_SOCKET_IMPL_BSD_SOCKETS)) && defined(FD_SETSIZE) 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!"); @@ -292,7 +292,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 -#if defined(FD_SETSIZE) && !defined(USE_SOCKET_IMPL_LWIP_TCP) +#if (defined(USE_SOCKET_IMPL_LWIP_SOCKETS) || defined(USE_SOCKET_IMPL_BSD_SOCKETS)) && defined(FD_SETSIZE) if (fd < 0 || fd >= FD_SETSIZE) return false;