Stabilize concurrent SSH and WebSocket transports

This commit is contained in:
2026-08-26 23:53:13 +02:00
parent a350ba2f5e
commit fa339a3dfa
7 changed files with 71 additions and 51 deletions
+18 -3
View File
@@ -27,7 +27,8 @@
#define WEB_SERIAL_ORIGIN_CAPACITY (sizeof("https://") + WEB_SERIAL_HOST_CAPACITY)
#define WEB_SERIAL_TICKET_RESPONSE_CAPACITY 96U
#define WEB_SERIAL_TASK_STACK_SIZE 6144U
#define WEB_SERIAL_TASK_PRIORITY 7U
#define WEB_SERIAL_TASK_PRIORITY 4U
#define WEB_SERIAL_ACTIVE_BURST_LOOPS 8U
#define WEB_SERIAL_POLL_MS 5U
#define WEB_SERIAL_DETACH_TIMEOUT_US 1000000LL
@@ -1214,6 +1215,8 @@ static void process_active_output(web_serial_slot_t *slot)
static void transport_task(void *context)
{
(void)context;
size_t active_burst_loops = 0U;
for (;;) {
for (size_t index = 0U; index < WEB_SERIAL_TRANSPORT_MAX_SESSIONS;
++index) {
@@ -1222,8 +1225,20 @@ static void transport_task(void *context)
process_broker_disconnect(slot);
process_active_output(slot);
}
(void)ulTaskNotifyTake(pdTRUE,
milliseconds_to_ticks(WEB_SERIAL_POLL_MS));
uint32_t notifications = ulTaskNotifyTake(
pdTRUE, milliseconds_to_ticks(WEB_SERIAL_POLL_MS));
if (notifications == 0U) {
active_burst_loops = 0U;
} else if (++active_burst_loops >= WEB_SERIAL_ACTIVE_BURST_LOOPS) {
active_burst_loops = 0U;
/*
* Send completion normally wakes this task immediately. Bound that
* producer/HTTPD hand-off so sustained serial output cannot keep an
* application task runnable forever and starve an idle watchdog.
*/
vTaskDelay(1U);
}
}
}