[core] Move host socket-select wake mechanism into wake.h/wake.cpp (#15931)

This commit is contained in:
J. Nick Koston
2026-04-23 15:53:10 +12:00
committed by GitHub
parent a881121110
commit 6f00ea1457
7 changed files with 263 additions and 269 deletions
@@ -6,6 +6,9 @@
#include <cstring>
#include "esphome/core/application.h"
#ifdef USE_HOST
#include "esphome/core/wake.h"
#endif
namespace esphome::socket {
@@ -16,7 +19,7 @@ BSDSocketImpl::BSDSocketImpl(int fd, bool monitor_loop) {
#ifdef USE_LWIP_FAST_SELECT
this->cached_sock_ = hook_fd_for_fast_select(this->fd_);
#else
this->loop_monitored_ = App.register_socket_fd(this->fd_);
this->loop_monitored_ = wake_register_fd(this->fd_);
#endif
}
@@ -36,7 +39,7 @@ int BSDSocketImpl::close() {
this->cached_sock_ = nullptr;
#else
if (this->loop_monitored_) {
App.unregister_socket_fd(this->fd_);
wake_unregister_fd(this->fd_);
}
#endif
int ret = ::close(this->fd_);