Crafter.Network/implementations
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jorijn van der Graaf b1b0633a27
fix(quic): SendSync throws only when its own send failed
SendSync waited on one sendInFlight flag per stream and, once woken,
threw QUICClosedException whenever the stream had finished shutting
down by then, even though its own send had completed. A peer that
answers at once and finishes the stream (echo, FIN, drop it, its Stop()
also stopping our sending side) completes the stream within a round
trip, which on loopback is shorter than a busy machine can take to wake
the sending thread, so SendSync threw for a send the peer had already
answered. The shared flag also let two SendSync calls on one stream wake
on each other's completion.

Each send now carries its own request: the copy msquic reads, the
QUIC_BUFFER describing it (msquic keeps a pointer to that, not a copy,
which the old code satisfied only because the waiter's stack outlived
the send), and an outcome shared with the waiter. SEND_COMPLETE, which
msquic delivers exactly once for every send it took and always before
the stream's SHUTDOWN_COMPLETE, records whether it was Canceled and
frees the request; SendSync returns unless its own send was canceled or
never completed.

Measured with ShouldReturnFromSendSyncQUIC, 2000 exchanges on fresh
connections four at a time: before, 1 or 2 spurious throws in 6 of 7
runs, the echo of each failed send arriving intact; after, none in 9
runs. It surfaced as one lost echo in a hundred in the OnClosed test
being written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 02:16:18 +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 fix(quic): SendSync throws only when its own send failed 2026-11-01 02:16:18 +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