DeterministicESPAsyncWebServer 1.2.0
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
session.cpp File Reference

Layer 5 (Session) — event queue processor implementation. More...

#include "session.h"

Go to the source code of this file.

Functions

void server_tick ()
 Drive the session layer for one Arduino loop iteration.
 

Detailed Description

Layer 5 (Session) — event queue processor implementation.

server_tick() is the only function here. Its bounded loop drains the entire FreeRTOS queue in one call so that the application layer always sees the most up-to-date state before checking http_pool[].

Definition in file session.cpp.

Function Documentation

◆ server_tick()

void server_tick ( )

Drive the session layer for one Arduino loop iteration.

Call this function from your loop() (or indirectly via DetWebServer::handle()). It performs three actions in order:

  1. Timeout sweep — calls DeterministicAsyncTCP::check_timeouts() to force-close connections that have been idle for > CONN_TIMEOUT_MS.
  2. Event drain — dequeues all pending TcpEvt records from the FreeRTOS queue. Each event is dispatched:
  3. Returns — upper layers may then inspect http_pool[] for PARSE_COMPLETE slots and send responses.
Note
The event-drain loop is bounded by the queue depth (16 entries). Even in the absolute worst case this function executes in O(1).

Definition at line 15 of file session.cpp.

References DeterministicAsyncTCP::check_timeouts(), EVT_CONNECT, EVT_DATA, EVT_DISCONNECT, EVT_ERROR, http_parse(), http_reset(), DeterministicAsyncTCP::queue, TcpEvt::slot_id, and TcpEvt::type.

Referenced by DetWebServer::handle().