diff --git a/esphome/components/esphome/ota/ota_esphome.cpp b/esphome/components/esphome/ota/ota_esphome.cpp index af2a609642..1999b88ef4 100644 --- a/esphome/components/esphome/ota/ota_esphome.cpp +++ b/esphome/components/esphome/ota/ota_esphome.cpp @@ -78,7 +78,9 @@ void ESPHomeOTAComponent::setup() { // every RCVPLUS across all monitored sockets (API client data, mDNS, etc.) would // pay the inline hook's two volatile stores + memw barriers to mark OTA // pending-enable, even though OTA would just re-disable itself on the next tick. - esphome_fast_select_set_ota_listener_sock(this->server_->get_cached_sock()); + // Uses the existing public esphome_lwip_get_sock() lookup instead of adding a + // dedicated accessor on Socket — the lookup happens once at setup, not per event. + esphome_fast_select_set_ota_listener_sock(esphome_lwip_get_sock(this->server_->get_fd())); #endif } diff --git a/esphome/components/socket/bsd_sockets_impl.h b/esphome/components/socket/bsd_sockets_impl.h index ceb7556d9f..e520784702 100644 --- a/esphome/components/socket/bsd_sockets_impl.h +++ b/esphome/components/socket/bsd_sockets_impl.h @@ -118,15 +118,6 @@ class BSDSocketImpl { int get_fd() const { return this->fd_; } -#ifdef USE_LWIP_FAST_SELECT - // Cached lwip_sock pointer captured at construction. Used by OTA to register its - // listener netconn with the fast-select wake hook filter so the hook only fires on - // OTA-relevant events. Returns nullptr for non-monitored sockets. - struct lwip_sock *get_cached_sock() const { - return this->cached_sock_; - } -#endif - protected: int fd_{-1}; #ifdef USE_LWIP_FAST_SELECT diff --git a/esphome/components/socket/lwip_sockets_impl.h b/esphome/components/socket/lwip_sockets_impl.h index cda37b5dc6..942d0ccf85 100644 --- a/esphome/components/socket/lwip_sockets_impl.h +++ b/esphome/components/socket/lwip_sockets_impl.h @@ -84,13 +84,6 @@ class LwIPSocketImpl { int get_fd() const { return this->fd_; } -#ifdef USE_LWIP_FAST_SELECT - // See BSDSocketImpl::get_cached_sock() — same purpose, same semantics. - struct lwip_sock *get_cached_sock() const { - return this->cached_sock_; - } -#endif - protected: int fd_{-1}; #ifdef USE_LWIP_FAST_SELECT