# h3_worker

URL: /pounce/api/h3_worker/
Section: api
Description: 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 the ``h3`` optional dependency (``pip install bengal-pounce[h3]``).

---

> For a complete page index, fetch /pounce/llms.txt.

Open LLM text
(/pounce/api/h3_worker/index.txt)

Share with AI

Ask Claude
(https://claude.ai/new?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpounce%2Fapi%2Fh3_worker%2Findex.txt)

Ask ChatGPT
(https://chatgpt.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpounce%2Fapi%2Fh3_worker%2Findex.txt)

Ask Gemini
(https://gemini.google.com/app?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpounce%2Fapi%2Fh3_worker%2Findex.txt)

Ask Copilot
(https://copilot.microsoft.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpounce%2Fapi%2Fh3_worker%2Findex.txt)

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 the`h3` optional dependency (`pip install bengal-pounce[h3]`).

1Class

## 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-wide`ext_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` (/pounce/api/supervisor/#Supervisor) 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`
