This commit is contained in:
J. Nick Koston
2026-03-01 14:06:39 -10:00
parent 9733c28c40
commit 52cc24880c
3 changed files with 3 additions and 1 deletions
@@ -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_) {
+1 -1
View File
@@ -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).