1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-02 19:32:19 +01:00

[core] Remove unnecessary FD_SETSIZE check on ESP32 and improve logging (#10255)

This commit is contained in:
J. Nick Koston
2025-08-15 22:26:48 -04:00
committed by GitHub
parent 6c5632a0b3
commit daf8ec36ab

View File

@@ -475,11 +475,16 @@ bool Application::register_socket_fd(int fd) {
if (fd < 0) if (fd < 0)
return false; return false;
#ifndef USE_ESP32
// Only check on non-ESP32 platforms
// On ESP32 (both Arduino and ESP-IDF), CONFIG_LWIP_MAX_SOCKETS is always <= FD_SETSIZE by design
// (LWIP_SOCKET_OFFSET = FD_SETSIZE - CONFIG_LWIP_MAX_SOCKETS per lwipopts.h)
// Other platforms may not have this guarantee
if (fd >= FD_SETSIZE) { if (fd >= FD_SETSIZE) {
ESP_LOGE(TAG, "Cannot monitor socket fd %d: exceeds FD_SETSIZE (%d)", fd, FD_SETSIZE); ESP_LOGE(TAG, "fd %d exceeds FD_SETSIZE %d", fd, FD_SETSIZE);
ESP_LOGE(TAG, "Socket will not be monitored for data - may cause performance issues!");
return false; return false;
} }
#endif
this->socket_fds_.push_back(fd); this->socket_fds_.push_back(fd);
this->socket_fds_changed_ = true; this->socket_fds_changed_ = true;