mirror of
https://github.com/esphome/esphome.git
synced 2026-09-03 11:36:03 +00:00
01beb56899202b4608f5cd6935d285c538842c8b
The inline OTA wake hook was firing on every NETCONN_EVT_RCVPLUS across every monitored socket (API client data packets, mDNS queries, web server, etc.). Each false fire paid two volatile stores + memw barriers to mark OTA pending-enable, only for OTA::loop() to run a wake-up tick and re-disable itself because there was no actual listener activity. Add a compare-against-listener filter in esphome_socket_event_callback so the wake hook only fires when `conn` matches the OTA listen socket's netconn. Non-match sockets now cost only a pointer load + one branch (~3 instructions) instead of the full ~10-instruction hook body. Plumbing: - lwip_fast_select.[ch]: new s_ota_listener_conn global + esphome_fast_select_set_ota_listener_sock() setter, used in the callback. - BSDSocketImpl / LwIPSocketImpl: new public get_cached_sock() accessor (only under USE_LWIP_FAST_SELECT) mirroring the existing get_fd() pattern. - ESPHomeOTAComponent::setup(): after registering the wake component, install the listener filter with this->server_->get_cached_sock(). Raw TCP (ESP8266/RP2040) is unaffected — that path wakes from LWIPRawListenImpl::accept_fn_, which only fires for the specific listener pcb it was registered on, so the filtering is implicit there.
Description
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
Readme
Multiple Licenses
582 MiB
Languages
C++
56%
Python
43.4%
C
0.3%
JavaScript
0.2%
