|
DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
|
Layer 5 (Session) - event queue dispatcher and session lifecycle. More...
#include "../transport/tcp.h"#include "freertos/FreeRTOS.h"#include "freertos/queue.h"#include <Arduino.h>Go to the source code of this file.
Functions | |
| void | server_tick (int worker_id=0) |
| Drive the session layer for one Arduino loop iteration. | |
| void | http_reset (uint8_t slot_id) |
| Reset the HTTP parser for a connection slot. | |
| void | http_conn_open (uint8_t slot_id) |
| Initialize a slot for a freshly-accepted HTTP connection. | |
| void | http_parse (uint8_t slot_id) |
| Drain the transport ring buffer and advance the HTTP parser. | |
Layer 5 (Session) - event queue dispatcher and session lifecycle.
The session layer is the bridge between the interrupt-driven transport layer and the application-layer HTTP handler. It processes all pending events from the FreeRTOS queue in a single bounded loop, ensuring that server_tick() has a deterministic worst-case execution time of O(queue_depth + MAX_CONNS).
Definition in file session.h.
| void server_tick | ( | int | worker_id = 0 | ) |
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:
Definition at line 91 of file session.cpp.
References Listener::active, DeterministicAsyncTCP::check_timeouts(), listener_pool, MAX_LISTENERS, and Listener::queue.
Referenced by DetWebServer::service_once().
| void http_reset | ( | uint8_t | slot_id | ) |
Reset the HTTP parser for a connection slot.
Delegates to http_parser_reset() for the slot's request struct. Silently ignores out-of-range slot IDs.
| slot_id | Index into conn_pool / http_pool (0 … MAX_CONNS-1). |
Definition at line 40 of file presentation.cpp.
References http_parser_reset(), http_pool, MAX_CONNS, and HttpReq::slot_id.
Referenced by DetWebServer::begin(), http_conn_open(), DetWebServer::http_poll_slot(), DetWebServer::redirect(), DetWebServer::send(), DetWebServer::send_chunked(), DetWebServer::send_empty(), DetWebServer::send_template(), and DetWebServer::stop().
| void http_conn_open | ( | uint8_t | slot_id | ) |
Initialize a slot for a freshly-accepted HTTP connection.
Resets the HTTP parser (like http_reset()) and, when keep-alive is enabled, zeroes the slot's persistent request counter. The session layer calls this on EvtType::EVT_CONNECT; http_reset() is used for the lighter inter-request reset that must not clear the counter. With keep-alive off this is identical to http_reset().
| slot_id | Index into conn_pool / http_pool (0 … MAX_CONNS-1). |
Definition at line 65 of file presentation.cpp.
References http_reset(), and MAX_CONNS.
| void http_parse | ( | uint8_t | slot_id | ) |
Drain the transport ring buffer and advance the HTTP parser.
Reads all available bytes from the slot's transport ring buffer and feeds each byte to http_parser_feed(). Stops early if the parser reaches a terminal state (ParseState::PARSE_COMPLETE, ParseState::PARSE_ERROR, ParseState::PARSE_ENTITY_TOO_LARGE, ParseState::PARSE_URI_TOO_LONG).
Silently ignores out-of-range slot IDs.
| slot_id | Connection slot to parse. |
Definition at line 76 of file presentation.cpp.
References http_parser_feed(), http_pool, MAX_CONNS, PARSE_COMPLETE, PARSE_ENTITY_TOO_LARGE, PARSE_ERROR, HttpReq::parse_state, PARSE_URI_TOO_LONG, and ws_find().
Referenced by DetWebServer::http_poll_slot().