From 51316f61c95280f331d5661e9e107cfc233d26aa Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 10 Apr 2026 21:32:53 -1000 Subject: [PATCH] [socket] Rename fast_select_hook_fd -> hook_fd_for_fast_select Disambiguates the verb-vs-noun parse of the original name. The new form reads as 'hook this fd for the fast-select path', matching the function's actual job. --- esphome/components/socket/bsd_sockets_impl.cpp | 2 +- esphome/components/socket/lwip_sockets_impl.cpp | 2 +- esphome/components/socket/socket.h | 9 +++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/esphome/components/socket/bsd_sockets_impl.cpp b/esphome/components/socket/bsd_sockets_impl.cpp index b73440ef55..92691b17ab 100644 --- a/esphome/components/socket/bsd_sockets_impl.cpp +++ b/esphome/components/socket/bsd_sockets_impl.cpp @@ -14,7 +14,7 @@ BSDSocketImpl::BSDSocketImpl(int fd, bool monitor_loop) { if (!monitor_loop || this->fd_ < 0) return; #ifdef USE_LWIP_FAST_SELECT - this->cached_sock_ = fast_select_hook_fd(this->fd_); + this->cached_sock_ = hook_fd_for_fast_select(this->fd_); #else this->loop_monitored_ = App.register_socket_fd(this->fd_); #endif diff --git a/esphome/components/socket/lwip_sockets_impl.cpp b/esphome/components/socket/lwip_sockets_impl.cpp index 618d17aabe..b4eba3febf 100644 --- a/esphome/components/socket/lwip_sockets_impl.cpp +++ b/esphome/components/socket/lwip_sockets_impl.cpp @@ -14,7 +14,7 @@ LwIPSocketImpl::LwIPSocketImpl(int fd, bool monitor_loop) { if (!monitor_loop || this->fd_ < 0) return; #ifdef USE_LWIP_FAST_SELECT - this->cached_sock_ = fast_select_hook_fd(this->fd_); + this->cached_sock_ = hook_fd_for_fast_select(this->fd_); #else this->loop_monitored_ = App.register_socket_fd(this->fd_); #endif diff --git a/esphome/components/socket/socket.h b/esphome/components/socket/socket.h index 739628ef43..204113e4b2 100644 --- a/esphome/components/socket/socket.h +++ b/esphome/components/socket/socket.h @@ -49,10 +49,11 @@ inline bool socket_ready(struct lwip_sock *cached_sock) { return cached_sock == nullptr || esphome_lwip_socket_has_data(cached_sock); } -/// Resolve an fd to its lwip_sock and hook the netconn event callback so the main loop -/// is woken by FreeRTOS task notifications. Shared between BSD and LwIP socket impls. -/// Returns the cached lwip_sock pointer (or nullptr if fd is invalid). -inline struct lwip_sock *fast_select_hook_fd(int fd) { +/// Resolve an fd to its lwip_sock and install the netconn event-callback hook so the +/// main loop is woken by FreeRTOS task notifications when data arrives. Shared between +/// BSD and LwIP socket impls on the fast-select path. Returns the cached lwip_sock +/// pointer (or nullptr if the fd does not map to a valid lwip_sock). +inline struct lwip_sock *hook_fd_for_fast_select(int fd) { struct lwip_sock *sock = esphome_lwip_get_sock(fd); if (sock != nullptr) { esphome_lwip_hook_socket(sock);