From dbf8d582c64a9f882d4c914e5457dc03014a69ac Mon Sep 17 00:00:00 2001 From: Will Miles Date: Wed, 3 Apr 2024 22:50:40 -0400 Subject: [PATCH 1/2] Respect CONFIG_ASYNC_TCP_EVENT_QUEUE_SIZE --- src/AsyncTCP.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AsyncTCP.cpp b/src/AsyncTCP.cpp index 68b31c6d..eb574617 100644 --- a/src/AsyncTCP.cpp +++ b/src/AsyncTCP.cpp @@ -95,7 +95,7 @@ static uint32_t _closed_index = []() { static inline bool _init_async_event_queue(){ if(!_async_queue){ - _async_queue = xQueueCreate(32, sizeof(lwip_event_packet_t *)); + _async_queue = xQueueCreate(CONFIG_ASYNC_TCP_EVENT_QUEUE_SIZE, sizeof(lwip_event_packet_t *)); if(!_async_queue){ return false; } From 2e11c7a2de871585cc4177f4f190c13094b75739 Mon Sep 17 00:00:00 2001 From: Will Miles Date: Wed, 3 Apr 2024 22:52:51 -0400 Subject: [PATCH 2/2] Increase default event queue size If the queue size is too small, the tasks can deadlock when the IP task needs to queue an event, but the service task is trying to execute an IP stack call. Raise the queue size to avoid this case; 4 events per connection seems to be enough. --- src/AsyncTCP.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AsyncTCP.h b/src/AsyncTCP.h index 3b0decb8..d67934e0 100644 --- a/src/AsyncTCP.h +++ b/src/AsyncTCP.h @@ -35,7 +35,7 @@ extern "C" { //#define CONFIG_ASYNC_TCP_DIAGNOSTICS 1 #ifndef CONFIG_ASYNC_TCP_EVENT_QUEUE_SIZE -#define CONFIG_ASYNC_TCP_EVENT_QUEUE_SIZE (CONFIG_LWIP_MAX_ACTIVE_TCP * 2) +#define CONFIG_ASYNC_TCP_EVENT_QUEUE_SIZE (CONFIG_LWIP_MAX_ACTIVE_TCP * 4) #endif //If core is not defined, then we are running in Arduino or PIO