[core] Move host socket-select wake mechanism into wake.h/wake.cpp (#15931)
This commit is contained in:
1 parent
a881121110
commit
6f00ea1457
7 files changed
+263
-269
No files matched your search
@@ -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