Crafter.Network/implementations
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jorijn van der Graaf f0769838e5
feat(quic): ClientQUIC::OnClosed tells the owner the connection is over
A ListenerQUIC hands each accepted connection to its callback as a
heap-allocated ClientQUIC the callback owns, and nothing said when to
delete it: the SHUTDOWN_COMPLETE handler closed the msquic handle of a
connection the peer or the idle timeout ended, but the object stayed, so
a server either leaked its peers or deleted them blind, and one still
alive at exit holds msquic's registration open until its idle timeout.

OnClosed(callback) is told once when the connection has shut down for
any reason but this object's destruction: the peer closed it, the idle
timeout or a transport error ended it, or Stop() was called. It runs on
the msquic worker, in the SHUTDOWN_COMPLETE handler, after that handler
has claimed and closed the handle, so deleting the ClientQUIC from
inside it is safe: ~ClientQUIC then finds no handle to claim and waits
for nothing. Delivering it there, rather than as a pool task, keeps it
independent of a pool the host shares and possibly saturates; the cost
is the usual worker rule, which the interface spells out (no blocking,
no *Sync call, no deleting another ClientQUIC from inside it). A
callback set after the close, which happens when the peer goes before a
ListenerQUIC's connectCallback runs, fires as a pool task instead, never
from inside OnClosed, where the caller is still using the object.

Its state is a shared CloseNotice rather than part of the Impl, since
the handler fires it after giving up the handle, when ~ClientQUIC on
another thread no longer waits for the worker and may free the Impl.
The rules are std::stop_callback's: ~ClientQUIC marks the owner gone
first, after which the callback never starts; one already running on
another thread is waited for, so the owner may free what it uses as
soon as the destructor returns; one on the destructor's own thread, a
callback deleting its connection, is not. The handler takes the handle
and the notice under one lock, so the destructor cannot slip between.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 02:18:50 +01:00
..
Crafter.Network-ClientHTTP-Browser.cpp SPDX license 2026-07-22 17:55:45 +02:00
Crafter.Network-ClientHTTP.cpp SPDX license 2026-07-22 17:55:45 +02:00
Crafter.Network-ClientHTTP1.cpp feat(http1): ClientHTTP1::Fetch follows redirects by the RFC, on a URL type 2026-10-31 20:39:43 +01:00
Crafter.Network-ClientQUIC-Browser.cpp feat: TCP-only builds; TCP options and timeouts; receives that report and keep what arrived 2026-10-20 20:04:57 +02:00
Crafter.Network-ClientQUIC.cpp feat(quic): ClientQUIC::OnClosed tells the owner the connection is over 2026-11-01 02:18:50 +01:00
Crafter.Network-ClientTCP.cpp feat(tcp): socket errors as std::system_error, with the phase that failed 2026-10-31 20:33:37 +01:00
Crafter.Network-ListenerHTTP.cpp feat(http): give ListenerHTTP the same fallback and query-strip routing 2026-07-28 19:42:06 +00:00
Crafter.Network-ListenerHTTP1.cpp test(https): give the TLS tests ports of their own 2026-07-28 20:34:23 +00:00
Crafter.Network-ListenerQUIC.cpp fix(listener): make the selfSigned QUIC certificate per user, in-process, without a race 2026-11-01 01:56:44 +01:00
Crafter.Network-ListenerTCP.cpp feat(tcp): ListenerTCP binds the address it is given, at port 0 if asked 2026-10-31 20:28:32 +01:00
Crafter.Network-Stream.cpp feat(tls): add a libssl TLS transport and an https:// HTTP/1.1 stack 2026-07-28 20:13:30 +00:00
Crafter.Network-TLS.cpp fix(listener): make the selfSigned QUIC certificate per user, in-process, without a race 2026-11-01 01:56:44 +01:00
Crafter.Network-WebTransport.cpp SPDX license 2026-07-22 17:55:45 +02:00