Module

h3_worker

HTTP/3 worker — runs QUIC/UDP datagram endpoint for HTTP/3.

Uses asyncio.create_datagram_endpoint with a pre-bound UDP socket. Shares app, config, lifecycle with the TCP Worker model but serves HTTP/3 over QUIC instead of HTTP/1.1 and HTTP/2 over TCP.

Requires theh3 optional dependency (pip install bengal-pounce[h3]).

Classes

H3Worker 8 ▼
Single-threaded async worker that serves HTTP/3 over QUIC/UDP. Uses create_datagram_endpoint with …

Single-threaded async worker that serves HTTP/3 over QUIC/UDP.

Uses create_datagram_endpoint with a pre-bound UDP socket. Zoomies provides sans-I/O QUIC; pounce owns the UDP loop and connection state.

Methods

set_lifespan_state 1 ▼
Set the lifespan state dict injected into H3 request scopes.
def set_lifespan_state(self, state: dict[str, Any]) -> None
Parameters
Name Type Description
state —
run 0 ▼
Start the H3 worker's event loop (blocking).
def run(self) -> None
shutdown 0 ▼
Signal the worker to stop.
def shutdown(self) -> None
shutdown_for_reload 0 ▼
Stop only this H3 generation without signalling TCP workers.
def shutdown_for_reload(self) -> None
Internal Methods 4 ▼
__init__ 8 ▼
def __init__(self, config: ServerConfig, app: ASGIApp, sock: socket.socket, *, worker_id: int = 0, shutdown_event: threading.Event | None = None, reload_shutdown_event: threading.Event | None = None, ssl_certfile: str, ssl_keyfile: str) -> None
Parameters
Name Type Description
config —
app —
sock —
worker_id — Default:0
shutdown_event — Default:None
reload_shutdown_event — Default:None
ssl_certfile —
ssl_keyfile —
_serve 0 ▼
Run the QUIC datagram endpoint until shutdown.
async
async def _serve(self) -> None
_bridge_shutdown 1 ▼
Poll the shared and per-worker shutdown events; set async shutdown. Either the…
async
async def _bridge_shutdown(self, ext_event: threading.Event | None) -> None

Poll the shared and per-worker shutdown events; set async shutdown.

Either the supervisor-wideext_event(global shutdown / restart) or the per-worker_reload_shutdown(single-generation graceful reload) ends the QUIC loop. Polling both keeps global shutdown working while letting graceful_reload retire one H3 generation in isolation.

Parameters
Name Type Description
ext_event —
_wake_async_shutdown 0 ▼
Wake the worker loop immediately instead of waiting for its poll tick.
def _wake_async_shutdown(self) -> None