Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4054c55
quic: for streams allow ReadableStream as body
martenrichter Oct 12, 2025
92c8540
quic: Fix linting
martenrichter Oct 12, 2025
66295dd
quic: Fix linting2
martenrichter Oct 12, 2025
2addb38
Test: catch close error
martenrichter Oct 18, 2025
8298457
quic: FIx several minor errors
martenrichter Oct 18, 2025
ec6d042
Fix DataQueueFeeder
martenrichter Oct 18, 2025
dcfda0d
Fix Acknowledgement
martenrichter Oct 18, 2025
90f6d44
Quic: fix Impl lifetime error
martenrichter Oct 19, 2025
4415d6d
Fix calling FinishClose multiple interleaving times
martenrichter Oct 19, 2025
3863860
quic: fix crash in DataFeeder impl
martenrichter Oct 19, 2025
9788760
quic: Fix linting 3
martenrichter Oct 19, 2025
d3ae4ea
quic: Fix linting 4
martenrichter Oct 19, 2025
5c29f16
quic: Move DataQueueFeeder parts to header for non-windows build
martenrichter Oct 19, 2025
0f287ca
quic: Move DataQueueFeeder to class body
martenrichter Oct 20, 2025
22313af
quic: Fix compilation on non-Windows
martenrichter Oct 20, 2025
61af974
quic: Fix lint and unused variable
martenrichter Oct 20, 2025
ce31222
quic: Fix format-cpp
martenrichter Oct 20, 2025
6e81e14
quic: Improve test coverage
martenrichter Nov 1, 2025
9a05acf
quic: Move helper functions to separate files
martenrichter Nov 2, 2025
1b62179
quic: add client to server unidirectional test
martenrichter Nov 2, 2025
85d2bf4
quic: Fix new test and lint
martenrichter Nov 2, 2025
1810338
quic: Fix new test 2
martenrichter Nov 2, 2025
f30048f
quic: Fix use after free in next
martenrichter Nov 2, 2025
3893c38
quic: Fix lint
martenrichter Nov 2, 2025
b22690d
quic: Fix crash if queue_ is nullptr
martenrichter Nov 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
quic: Improve test coverage
  • Loading branch information
martenrichter committed Nov 3, 2025
commit 6e81e14385986fec48d5bee4faecd765ed63acf3
13 changes: 13 additions & 0 deletions src/quic/streams.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1433,6 +1433,17 @@ JS_METHOD_IMPL(DataQueueFeeder::Error) {
feeder->DrainAndClose();
}

JS_METHOD_IMPL(DataQueueFeeder::AddFakePull) {
DataQueueFeeder* feeder;
ASSIGN_OR_RETURN_UNWRAP(&feeder, args.This());
// this adds a fake pull for testing code, not to be used anywhere else
Next dummyNext = [](int, const DataQueue::Vec*, size_t, bob::Done) {
// intentionally empty
};
feeder->addPendingPull(PendingPull(std::move(dummyNext)));
feeder->tryWakePulls();
}

JS_CONSTRUCTOR_IMPL(DataQueueFeeder, dataqueuefeeder_constructor_template, {
auto isolate = env->isolate();
JS_NEW_CONSTRUCTOR();
Expand All @@ -1441,6 +1452,7 @@ JS_CONSTRUCTOR_IMPL(DataQueueFeeder, dataqueuefeeder_constructor_template, {
SetProtoMethod(isolate, tmpl, "error", Error);
SetProtoMethod(isolate, tmpl, "submit", Submit);
SetProtoMethod(isolate, tmpl, "ready", Ready);
SetProtoMethod(isolate, tmpl, "addFakePull", AddFakePull);
})

void DataQueueFeeder::InitPerIsolate(IsolateData* data,
Expand All @@ -1461,6 +1473,7 @@ void DataQueueFeeder::RegisterExternalReferences(
registry->Register(Submit);
registry->Register(Error);
registry->Register(Ready);
registry->Register(AddFakePull);
}

} // namespace node
Expand Down
1 change: 1 addition & 0 deletions src/quic/streams.h
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ class DataQueueFeeder final : public AsyncWrap {
JS_METHOD(Submit);
JS_METHOD(Error);
JS_METHOD(Ready);
JS_METHOD(AddFakePull);

private:
std::shared_ptr<DataQueue> dataQueue_;
Expand Down
40 changes: 40 additions & 0 deletions test/parallel/test-quic-internal-dataqueuefeeder.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Flags: --expose-internals --experimental-quic --no-warnings
import { hasQuic, skip } from '../common/index.mjs';
import {
rejects,
} from 'node:assert';

if (!hasQuic) {
skip('QUIC is not enabled');
}

const { internalBinding } = (await import('internal/test/binding')).default;

const {
DataQueueFeeder,
} = internalBinding('quic');


const feeder = new DataQueueFeeder();
feeder.addFakePull();
await feeder.ready();
let lastprom = feeder.submit(new Uint8Array([1, 2, 3]), false);
feeder.addFakePull();
await lastprom;
lastprom = feeder.submit(new Uint16Array([1, 2, 3]), false);
feeder.addFakePull();
await lastprom;
lastprom = feeder.submit(new Uint32Array([1, 2, 3]), false);
feeder.addFakePull();
await lastprom;
lastprom = feeder.submit(new Uint8Array([1, 2, 3]).buffer, false);
feeder.addFakePull();
await lastprom;
await rejects(async () => feeder.submit({}, false), {
code: 'ERR_INVALID_ARG_TYPE',
});
await rejects(async () => feeder.submit([], false), {
code: 'ERR_INVALID_ARG_TYPE',
});
await feeder.submit(undefined, true);
feeder.error(new Error('Can we send an error'));
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const KNOWN_BYTES_LONG = [
createBytesChunk(60000), // 96, 234
createBytesChunk(12), // 0, 12
createBytesChunk(50000), // 195, 80
createBytesChunk(1600), // 6, 64
createBytesChunk(1600).buffer, // 6, 64 we use buffer here to increae test coverage
createBytesChunk(20000), // 78, 32
createBytesChunk(30000), // 117, 48
];
Expand Down