This commit is contained in:
Jorijn van der Graaf 2026-08-25 19:18:32 +02:00
commit 9a5cab88eb
5 changed files with 280 additions and 16 deletions

View file

@ -180,9 +180,11 @@ namespace Crafter {
// via OnStream()).
// - Unreliable, unordered datagrams (SendDatagram() / OnDatagram()).
//
// Lifetime: ~ClientQUIC closes the connection. Streams obtained from
// OpenStream() are scoped to the connection and must be destroyed (or
// moved out) before the ClientQUIC.
// Lifetime: ~ClientQUIC shuts the connection down and closes it, waiting
// (bounded — 5s) for every stream on it to finish closing first, since
// QUICStream::Stop only initiates a shutdown that completes asynchronously.
// Streams outliving the connection are therefore safe to hold, though they
// are dead once it goes; prefer destroying or moving them out first.
//
// Browser build: the only QUIC-shaped API the browser exposes is
// WebTransport, which is HTTP/3-based and reached at a fixed URL. Here:
@ -209,6 +211,8 @@ namespace Crafter {
// Client constructor: connects to host:port using QUIC. ALPN must
// match the listener. Throws QUICException on connect failure.
// Blocks for at most the handshake idle timeout (10s), so a host that
// never answers fails in seconds rather than at the idle timeout.
ClientQUIC(const char* host, std::uint16_t port, std::string alpn,
QUICClientCredentials creds = {});
ClientQUIC(std::string host, std::uint16_t port, std::string alpn,