MCPcopy Index your code
hub / github.com/nodejs/node / waitForDrain

Function waitForDrain

lib/internal/quic/quic.js:1424–1432  ·  view source on GitHub ↗
(stream)

Source from the content-addressed store, hash-verified

1422// Waits for the stream's drain callback to fire, indicating the
1423// outbound has capacity for more data.
1424function waitForDrain(stream) {
1425 const { promise, resolve } = PromiseWithResolvers();
1426 const prevDrain = stream[kDrain];
1427 stream[kDrain] = () => {
1428 stream[kDrain] = prevDrain;
1429 resolve();
1430 };
1431 return promise;
1432}
1433
1434// Writes a batch to the handle, awaiting drain if backpressured.
1435// Returns true if the stream was destroyed during the wait.

Callers 1

writeBatchWithDrainFunction · 0.70

Calls 1

resolveFunction · 0.50

Tested by

no test coverage detected