# `Quiver.Pool.HTTP3.Connection`
[🔗](https://github.com/edlontech/quiver/blob/main/lib/quiver/pool/http3/connection.ex#L1)

gen_state_machine process owning a single HTTP/3 connection via `:quic_h3`.

Translates `{:quic_h3, _, _}` events into caller replies. Supports
buffered request/response, response streaming, request body streaming,
and GOAWAY-driven connection draining.

State machine:

    :connecting -> :connected -> :draining

The worker transitions to `:draining` on receiving a peer-initiated
`{:quic_h3, _, {:goaway, GoawayId}}` or self-initiated
`{:quic_h3, _, {:goaway_sent, GoawayId}}` event. While draining, in-flight
requests with `stream_id < goaway_id` continue to completion; everything
else fails with `Quiver.Error.H3GoAway`. New `:forward_request` /
`:forward_stream` messages are refused. The worker stops `:normal` when
no requests remain.

Note: request body streaming uses `{:stream_chunk, sid, chunk}` and
`{:stream_end, sid}` info messages, whereas the HTTP/2 sibling uses
different naming. Aligning the two is tracked separately.

# `origin`

```elixir
@type origin() :: {atom(), String.t(), :inet.port_number()}
```

# `t`

```elixir
@type t() :: %Quiver.Pool.HTTP3.Connection{
  config: keyword(),
  connect_candidates: [:inet.ip_address()],
  connect_h3_opts: map() | nil,
  early_capable: boolean(),
  goaway_id: non_neg_integer() | nil,
  h3_conn: pid() | nil,
  h3_conn_mon: reference() | nil,
  handshake_start: integer() | nil,
  monitors: map(),
  origin: origin(),
  peer_max_streams: non_neg_integer(),
  pending_during_connect: [tuple()],
  pool_pid: pid() | nil,
  quic_conn: pid() | nil,
  replay_queue: [tuple()],
  requests: map(),
  session_ticket: binary() | nil,
  stream_idle_timeout: non_neg_integer(),
  stream_tasks: map(),
  stream_to_ref: map()
}
```

# `connected`

# `connecting`

# `draining`

# `max_streams`

```elixir
@spec max_streams(pid()) :: non_neg_integer()
```

Returns the peer's advertised concurrent stream limit once the connection
has reached `:connected`. Returns `0` while still handshaking.

# `start_link`

```elixir
@spec start_link(keyword()) :: GenServer.on_start()
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
