Skip to content

Commit a65296d

Browse files
committed
quic: remove stream pending code
Removing no longer needed code PR-URL: #34351 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent da20287 commit a65296d

File tree

2 files changed

+1
-43
lines changed

2 files changed

+1
-43
lines changed

lib/internal/quic/core.js

+1-42
Original file line numberDiff line numberDiff line change
@@ -1666,7 +1666,6 @@ class QuicSession extends EventEmitter {
16661666
silentClose: false,
16671667
statelessReset: false,
16681668
stats: undefined,
1669-
pendingStreams: new Set(),
16701669
streams: new Map(),
16711670
verifyErrorReason: undefined,
16721671
verifyErrorCode: undefined,
@@ -1969,12 +1968,6 @@ class QuicSession extends EventEmitter {
19691968
return;
19701969
state.destroyed = true;
19711970

1972-
// Destroy any pending streams immediately. These
1973-
// are streams that have been created but have not
1974-
// yet been assigned an internal handle.
1975-
for (const stream of state.pendingStreams)
1976-
stream.destroy(error);
1977-
19781971
// Destroy any remaining streams immediately.
19791972
for (const stream of state.streams.values())
19801973
stream.destroy(error);
@@ -2534,7 +2527,7 @@ function streamOnResume() {
25342527
}
25352528

25362529
function streamOnPause() {
2537-
if (!this.destroyed /* && !this.pending */)
2530+
if (!this.destroyed)
25382531
this[kHandle].readStop();
25392532
}
25402533

@@ -2658,9 +2651,6 @@ class QuicStream extends Duplex {
26582651
if (this.destroyed || state.closed)
26592652
return;
26602653

2661-
if (this.pending)
2662-
return this.once('ready', () => this[kClose](family, code));
2663-
26642654
state.closed = true;
26652655

26662656
state.aborted = this.readable || this.writable;
@@ -2712,11 +2702,6 @@ class QuicStream extends Duplex {
27122702
// TODO(@jasnell): Implement this later
27132703
}
27142704

2715-
get pending() {
2716-
// The id is set in the kSetHandle function
2717-
return this[kInternalState].id === undefined;
2718-
}
2719-
27202705
get aborted() {
27212706
return this[kInternalState].aborted;
27222707
}
@@ -2741,16 +2726,6 @@ class QuicStream extends Duplex {
27412726
if (this.destroyed)
27422727
return; // TODO(addaleax): Can this happen?
27432728

2744-
// The stream should be corked while still pending
2745-
// but just in case uncork
2746-
// was called early, defer the actual write until the
2747-
// ready event is emitted.
2748-
if (this.pending) {
2749-
return this.once('ready', () => {
2750-
this[kWriteGeneric](writev, data, encoding, cb);
2751-
});
2752-
}
2753-
27542729
this[kUpdateTimer]();
27552730
const req = (writev) ?
27562731
writevGeneric(this, data, cb) :
@@ -2774,13 +2749,6 @@ class QuicStream extends Duplex {
27742749
// coming so that a fin stream packet can be
27752750
// sent.
27762751
_final(cb) {
2777-
// The QuicStream should be corked while pending
2778-
// so this shouldn't be called, but just in case
2779-
// the stream was prematurely uncorked, defer the
2780-
// operation until the ready event is emitted.
2781-
if (this.pending)
2782-
return this.once('ready', () => this._final(cb));
2783-
27842752
const handle = this[kHandle];
27852753
if (handle === undefined) {
27862754
cb();
@@ -2796,9 +2764,6 @@ class QuicStream extends Duplex {
27962764
}
27972765

27982766
_read(nread) {
2799-
if (this.pending)
2800-
return this.once('ready', () => this._read(nread));
2801-
28022767
if (this.destroyed) { // TODO(addaleax): Can this happen?
28032768
this.push(null);
28042769
return;
@@ -2848,12 +2813,6 @@ class QuicStream extends Duplex {
28482813
else if (typeof fd !== 'number')
28492814
throw new ERR_INVALID_ARG_TYPE('fd', ['number', 'FileHandle'], fd);
28502815

2851-
if (this.pending) {
2852-
return this.once('ready', () => {
2853-
this.sendFD(fd, { offset, length }, ownsFd);
2854-
});
2855-
}
2856-
28572816
this[kUpdateTimer]();
28582817
this.ownsFd = ownsFd;
28592818

test/parallel/test-quic-client-server.js

-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ client.on('close', common.mustCall(onSocketClose.bind(client)));
170170
assert(!stream.unidirectional);
171171
assert(stream.clientInitiated);
172172
assert(!stream.serverInitiated);
173-
assert(!stream.pending);
174173

175174
const file = fs.createReadStream(__filename);
176175
let data = '';

0 commit comments

Comments
 (0)