mirror of
https://github.com/esphome/esphome.git
synced 2026-09-13 16:18:41 +00:00
guards
This commit is contained in:
@@ -34,6 +34,7 @@ int BSDSocketImpl::close() {
|
||||
#ifdef USE_LWIP_FAST_SELECT
|
||||
if (this->loop_monitored_) {
|
||||
App.unregister_socket(this->cached_sock_);
|
||||
this->cached_sock_ = nullptr;
|
||||
}
|
||||
#else
|
||||
if (this->loop_monitored_) {
|
||||
|
||||
@@ -34,6 +34,7 @@ int LwIPSocketImpl::close() {
|
||||
#ifdef USE_LWIP_FAST_SELECT
|
||||
if (this->loop_monitored_) {
|
||||
App.unregister_socket(this->cached_sock_);
|
||||
this->cached_sock_ = nullptr;
|
||||
}
|
||||
#else
|
||||
if (this->loop_monitored_) {
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace esphome::socket {
|
||||
// Shared ready() implementation for fd-based socket implementations (BSD and LWIP sockets).
|
||||
// Uses cached lwip_sock pointer for direct rcvevent read — no fd lookup overhead.
|
||||
bool socket_ready(struct lwip_sock *cached_sock, bool loop_monitored) {
|
||||
return !loop_monitored || esphome_lwip_socket_has_data(cached_sock);
|
||||
return !loop_monitored || (cached_sock != nullptr && esphome_lwip_socket_has_data(cached_sock));
|
||||
}
|
||||
#elif defined(USE_SOCKET_SELECT_SUPPORT)
|
||||
// Shared ready() implementation for fd-based socket implementations (BSD and LWIP sockets).
|
||||
|
||||
Reference in New Issue
Block a user