[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.
This commit is contained in:
J. Nick Koston
2026-04-10 21:32:53 -10:00
parent 87c0538884
commit 51316f61c9
3 changed files with 7 additions and 6 deletions
@@ -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
@@ -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
+5 -4
View File
@@ -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);