| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -410,6 +410,12 @@ class DefaultApplication final : public Session::Application { | |||
| 410 | 410 | ||
| 411 | 411 | void ResumeStream(stream_id id) override { ScheduleStream(id); } | |
| 412 | 412 | ||
| 413 | + void StreamWriteShut(stream_id id) override { | ||
| 414 | + if (auto stream = session().FindStream(id)) [[likely]] { | ||
| 415 | + stream->Unschedule(); | ||
| 416 | + } | ||
| 417 | + } | ||
| 418 | + | ||
| 413 | 419 | void BlockStream(stream_id id) override { | |
| 414 | 420 | if (auto stream = session().FindStream(id)) [[likely]] { | |
| 415 | 421 | // Remove the stream from the send queue. It will be re-scheduled | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,49 @@ | |||
| 1 | + // Flags: --experimental-quic --no-warnings | ||
| 2 | + | ||
| 3 | + // A peer STOP_SENDING must unschedule buffered outbound data. | ||
| 4 | + | ||
| 5 | + import { hasQuic, mustCall, skip } from '../common/index.mjs'; | ||
| 6 | + import assert from 'node:assert'; | ||
| 7 | + | ||
| 8 | + if (!hasQuic) { | ||
| 9 | + skip('QUIC is not enabled'); | ||
| 10 | + } | ||
| 11 | + | ||
| 12 | + const { connect, listen } = await import('../common/quic.mjs'); | ||
| 13 | + | ||
| 14 | + const serverStreamReady = Promise.withResolvers(); | ||
| 15 | + const clientBuffered = Promise.withResolvers(); | ||
| 16 | + const serverReset = Promise.withResolvers(); | ||
| 17 | + | ||
| 18 | + const serverEndpoint = await listen(mustCall((serverSession) => { | ||
| 19 | + serverSession.onstream = mustCall(async (stream) => { | ||
| 20 | + serverStreamReady.resolve(); | ||
| 21 | + await clientBuffered.promise; | ||
| 22 | + | ||
| 23 | + const closed = assert.rejects(stream.closed, { | ||
| 24 | + code: 'ERR_QUIC_APPLICATION_ERROR', | ||
| 25 | + }); | ||
| 26 | + stream.stopSending(1n); | ||
| 27 | + stream.writer.endSync(); | ||
| 28 | + await closed; | ||
| 29 | + serverSession.close(); | ||
| 30 | + serverReset.resolve(); | ||
| 31 | + }); | ||
| 32 | + })); | ||
| 33 | + | ||
| 34 | + const clientSession = await connect(serverEndpoint.address); | ||
| 35 | + await clientSession.opened; | ||
| 36 | + | ||
| 37 | + const stream = await clientSession.createBidirectionalStream(); | ||
| 38 | + const clientClosed = stream.closed.catch(() => {}); | ||
| 39 | + const writer = stream.writer; | ||
| 40 | + writer.writeSync(new Uint8Array([1])); | ||
| 41 | + await serverStreamReady.promise; | ||
| 42 | + | ||
| 43 | + writer.writeSync(new Uint8Array(64 * 1024)); | ||
| 44 | + clientBuffered.resolve(); | ||
| 45 | + | ||
| 46 | + await serverReset.promise; | ||
| 47 | + | ||
| 48 | + await Promise.all([clientClosed, clientSession.closed]); | ||
| 49 | + await serverEndpoint.close(); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments