mirror of
https://github.com/esphome/esphome.git
synced 2026-10-11 13:54:12 +00:00
[core] Move host socket-select wake mechanism into wake.h/wake.cpp (#15931)
This commit is contained in:
@@ -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_);
|
||||
|
||||
Reference in New Issue
Block a user