Skip to content

Commit b894b6b

Browse files
committed
quic: fix fin handling, so it is broken
1 parent e1820bb commit b894b6b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎lib/internal/blob.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,9 @@ async function* createBlobReaderIterable(reader, options = kEmptyObject) {
582582
const { getReadError } = options;
583583
let wakeup = PromiseWithResolvers();
584584
let immediate;
585-
reader.setWakeup(() => {
585+
let fin = false;
586+
reader.setWakeup((setfin) => {
587+
fin ||= setfin;
586588
if (typeof immediate === 'undefined') {
587589
// Postpone the execution to the next steps of the event loop
588590
immediate = setImmediate(() => {
@@ -635,7 +637,7 @@ async function* createBlobReaderIterable(reader, options = kEmptyObject) {
635637
if (error) throw error;
636638

637639
if (blocked) {
638-
const fin = await wakeup.promise;
640+
await wakeup.promise;
639641
wakeup = PromiseWithResolvers();
640642
// If the wakeup was triggered by FIN (EndReadable), the DataQueue
641643
// is capped. Continue the loop to pull again -- the next pull will

0 commit comments

Comments
 (0)