mirror of
https://github.com/esphome/esphome.git
synced 2026-09-14 08:38:39 +00:00
[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:
@@ -14,7 +14,7 @@ BSDSocketImpl::BSDSocketImpl(int fd, bool monitor_loop) {
|
|||||||
if (!monitor_loop || this->fd_ < 0)
|
if (!monitor_loop || this->fd_ < 0)
|
||||||
return;
|
return;
|
||||||
#ifdef USE_LWIP_FAST_SELECT
|
#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
|
#else
|
||||||
this->loop_monitored_ = App.register_socket_fd(this->fd_);
|
this->loop_monitored_ = App.register_socket_fd(this->fd_);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ LwIPSocketImpl::LwIPSocketImpl(int fd, bool monitor_loop) {
|
|||||||
if (!monitor_loop || this->fd_ < 0)
|
if (!monitor_loop || this->fd_ < 0)
|
||||||
return;
|
return;
|
||||||
#ifdef USE_LWIP_FAST_SELECT
|
#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
|
#else
|
||||||
this->loop_monitored_ = App.register_socket_fd(this->fd_);
|
this->loop_monitored_ = App.register_socket_fd(this->fd_);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -49,10 +49,11 @@ inline bool socket_ready(struct lwip_sock *cached_sock) {
|
|||||||
return cached_sock == nullptr || esphome_lwip_socket_has_data(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
|
/// Resolve an fd to its lwip_sock and install the netconn event-callback hook so the
|
||||||
/// is woken by FreeRTOS task notifications. Shared between BSD and LwIP socket impls.
|
/// main loop is woken by FreeRTOS task notifications when data arrives. Shared between
|
||||||
/// Returns the cached lwip_sock pointer (or nullptr if fd is invalid).
|
/// BSD and LwIP socket impls on the fast-select path. Returns the cached lwip_sock
|
||||||
inline struct lwip_sock *fast_select_hook_fd(int fd) {
|
/// 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);
|
struct lwip_sock *sock = esphome_lwip_get_sock(fd);
|
||||||
if (sock != nullptr) {
|
if (sock != nullptr) {
|
||||||
esphome_lwip_hook_socket(sock);
|
esphome_lwip_hook_socket(sock);
|
||||||
|
|||||||
Reference in New Issue
Block a user