Skip to content

Commit

Permalink
limit _async_service_task watchdog to guard only recv/poll callbacks
Browse files Browse the repository at this point in the history
others are not critical and could skip setting/removing watchdog each time
  • Loading branch information
vortigont committed Dec 14, 2024
1 parent afa162b commit 825a2e9
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/AsyncTCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ static inline bool _get_async_event(lwip_event_packet_t** e) {
if (xQueueReceive(_async_queue, &next_pkt, 0) == pdPASS){
free(next_pkt);
next_pkt = NULL;
log_w("coalescing polls, async callback might be too slow!");
log_d("coalescing polls, async callback might be too slow!");
} else
return true;
} else
Expand Down Expand Up @@ -259,15 +259,23 @@ static void _async_service_task(void* pvParameters) {
for (;;) {
if (_get_async_event(&packet)) {
#if CONFIG_ASYNC_TCP_USE_WDT
if (esp_task_wdt_add(NULL) != ESP_OK) {
log_e("Failed to add async task to WDT");
switch((size_t)packet->arg){
case LWIP_TCP_RECV:
case LWIP_TCP_POLL:
if (esp_task_wdt_add(NULL) != ESP_OK) {
log_e("Failed to add async task to WDT");
}
_handle_async_event(packet);
if (esp_task_wdt_delete(NULL) != ESP_OK) {
log_e("Failed to remove async task from WDT");
}
break;

default:
_handle_async_event(packet);
}
#endif
#else
_handle_async_event(packet);
#if CONFIG_ASYNC_TCP_USE_WDT
if (esp_task_wdt_delete(NULL) != ESP_OK) {
log_e("Failed to remove loop task from WDT");
}
#endif
}
}
Expand Down

0 comments on commit 825a2e9

Please sign in to comment.