Repository navigation
Commit 5710879
committed
Replace HTTP/3 stream wait futures with custom wakers
WaitingStreams previously stored Abortable<WaitForStream> values in a
FuturesUnordered with per-direction abort maps. Each wait existed only
to register a channel waker and return readiness to H3Driver.
Channel endpoints now remain in StreamCtx with one shared StreamWake per
stream. RecvState owns RecvDelivery in Open and FinPending, pairing the
app-bound sender with its capacity-wait flag. mark_fin_pending moves the
whole payload, preserving waits. Closed drops both without manual wait
cancellation. Capacity polling retains Pending waits and releases its
readiness permit before application reads. Closed delivery cannot wait.
The outbound receiver remains independent because queued FIN can drop
it before transport writes finish. An outbound waiting flag identifies
the receiver to re-poll, and stale ready IDs are ignored after cleanup.
ReadyStreams encapsulates coalescing: the queue owns Arc<StreamWake>
notifications, and dequeue clears their AtomicBool before returning a
stream ID. Channel polling no longer participates in queue
acknowledgment. Direct polls preserve queued notifications; dequeue
rearms wakes even without a subsequent channel poll. Wake metadata owns
no stream endpoints.
STOP is probed before H3 frame validation, except for queued
PeerStreamError. STOP drains ordinary buffered frames, preserves
PeerStreamError, and redispatches it to close both directions. Errors
sent later through outstanding permits are rejected when the receiver is
dropped.
App-bound readiness is serviced before outbound data. Ready-queue
draining retains Tokio cooperative budgeting. Regressions verify FIN
wait preservation, automatic wait removal on closure, stale wakes,
cooperative yields, wake coalescing, and deferred cleanup. Remaining
lifecycle invariant checks have runtime paths and debug assertions.
The cooperative-yield regression bounds its post-yield receive with a
deadline. A lost readiness notification fails both channel-direction
cases instead of leaving the test suite waiting indefinitely.
Peer-reset handling remains idempotent when the body reader and HTTP/3
polling both report a reset. Unit coverage checks repeated notifications
after open or FIN-pending delivery and verifies that capacity waits are
dropped without closing the response channel. Strict cancellation checks
apply only to local reset and STOP operations.1 parent 3753036 commit 5710879
7 files changed
Lines changed: 1010 additions & 629 deletions
File tree
- tokio-quiche/src/http3/driver
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
| 15 | + | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
26 | | - | |
| 25 | + | |
27 | 26 | | |
28 | 27 | | |
29 | | - | |
| 28 | + | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
36 | | - | |
37 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
| |||
45 | 48 | | |
46 | 49 | | |
47 | 50 | | |
48 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
49 | 60 | | |
50 | 61 | | |
51 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
214 | | - | |
215 | | - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
216 | 219 | | |
217 | 220 | | |
218 | 221 | | |
| |||
235 | 238 | | |
236 | 239 | | |
237 | 240 | | |
238 | | - | |
239 | | - | |
240 | | - | |
| 241 | + | |
241 | 242 | | |
242 | 243 | | |
243 | 244 | | |
| |||
0 commit comments