From 756b00b59d16a9c2fc908b8115807b53cc8e61ba Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 10 Mar 2026 14:10:38 -1000 Subject: [PATCH] Reduce MAX_ACCEPTED_SOCKETS from 3 to 2 --- esphome/components/socket/lwip_raw_tcp_impl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/components/socket/lwip_raw_tcp_impl.h b/esphome/components/socket/lwip_raw_tcp_impl.h index 01daf00c83..1bba8ecf0e 100644 --- a/esphome/components/socket/lwip_raw_tcp_impl.h +++ b/esphome/components/socket/lwip_raw_tcp_impl.h @@ -187,8 +187,8 @@ class LWIPRawListenImpl : public LWIPRawCommon { // LWIPRawImpl creation is deferred to the main-loop accept() call. This avoids: // - Heap allocation in the accept callback (unsafe from IRQ context on RP2040) // - Dangling LWIPRawImpl if the connection errors before accept() picks it up - // 3 slots is plenty since connections are pulled out quickly by the event loop. - static constexpr size_t MAX_ACCEPTED_SOCKETS = 3; + // 2 slots is plenty since the main loop drains the queue every iteration. + static constexpr size_t MAX_ACCEPTED_SOCKETS = 2; std::array accepted_pcbs_{}; uint8_t accepted_socket_count_ = 0; // Number of PCBs currently in queue };