|
DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
|
Layer 5 (Session) - event queue processor implementation. More...
#include "session.h"#include "../transport/listener.h"#include "proto_handler.h"#include "scratch.h"Go to the source code of this file.
Classes | |
| struct | SessionCtx |
Functions | |
| void | proto_register (ConnProto proto, const ProtoHandler *h) |
Register h for protocol proto (replaces any previous handler). | |
| const ProtoHandler * | proto_get (ConnProto proto) |
Look up the handler for proto. | |
| void | server_tick (int worker_id) |
| Drive the session layer for one Arduino loop iteration. | |
Layer 5 (Session) - event queue processor implementation.
server_tick() is the only function here. Its bounded loop drains every active listener's FreeRTOS queue in one call so that the application layer always sees the most up-to-date state before checking http_pool[].
Events are routed to the correct protocol handler via TcpConn::proto. A slot must carry an explicit protocol (assigned from its listener on accept); ConnProto::PROTO_NONE and any unregistered protocol resolve to no handler and the event is dropped.
Definition in file session.cpp.
| void proto_register | ( | ConnProto | proto, |
| const ProtoHandler * | h | ||
| ) |
Register h for protocol proto (replaces any previous handler).
Definition at line 38 of file session.cpp.
References DETWS_PROTO_MAX, and SessionCtx::proto_handlers.
| const ProtoHandler * proto_get | ( | ConnProto | proto | ) |
Look up the handler for proto.
proto is ConnProto::PROTO_NONE or has no registered handler (no implicit fallback; the event is dropped). Definition at line 44 of file session.cpp.
References DETWS_PROTO_MAX, SessionCtx::proto_handlers, PROTO_HTTP, and proto_register_builtins().
Referenced by DetWebServer::service_once().
| 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().