Skip to content

Commit

Permalink
quic: remove stream pending code
Browse files Browse the repository at this point in the history
Removing no longer needed code

PR-URL: #34351
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
jasnell committed Jul 23, 2020
1 parent da20287 commit a65296d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 43 deletions.
43 changes: 1 addition & 42 deletions lib/internal/quic/core.js
Expand Up @@ -1666,7 +1666,6 @@ class QuicSession extends EventEmitter {
silentClose: false,
statelessReset: false,
stats: undefined,
pendingStreams: new Set(),
streams: new Map(),
verifyErrorReason: undefined,
verifyErrorCode: undefined,
Expand Down Expand Up @@ -1969,12 +1968,6 @@ class QuicSession extends EventEmitter {
return;
state.destroyed = true;

// Destroy any pending streams immediately. These
// are streams that have been created but have not
// yet been assigned an internal handle.
for (const stream of state.pendingStreams)
stream.destroy(error);

// Destroy any remaining streams immediately.
for (const stream of state.streams.values())
stream.destroy(error);
Expand Down Expand Up @@ -2534,7 +2527,7 @@ function streamOnResume() {
}

function streamOnPause() {
if (!this.destroyed /* && !this.pending */)
if (!this.destroyed)
this[kHandle].readStop();
}

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

if (this.pending)
return this.once('ready', () => this[kClose](family, code));

state.closed = true;

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

get pending() {
// The id is set in the kSetHandle function
return this[kInternalState].id === undefined;
}

get aborted() {
return this[kInternalState].aborted;
}
Expand All @@ -2741,16 +2726,6 @@ class QuicStream extends Duplex {
if (this.destroyed)
return; // TODO(addaleax): Can this happen?

// The stream should be corked while still pending
// but just in case uncork
// was called early, defer the actual write until the
// ready event is emitted.
if (this.pending) {
return this.once('ready', () => {
this[kWriteGeneric](writev, data, encoding, cb);
});
}

this[kUpdateTimer]();
const req = (writev) ?
writevGeneric(this, data, cb) :
Expand All @@ -2774,13 +2749,6 @@ class QuicStream extends Duplex {
// coming so that a fin stream packet can be
// sent.
_final(cb) {
// The QuicStream should be corked while pending
// so this shouldn't be called, but just in case
// the stream was prematurely uncorked, defer the
// operation until the ready event is emitted.
if (this.pending)
return this.once('ready', () => this._final(cb));

const handle = this[kHandle];
if (handle === undefined) {
cb();
Expand All @@ -2796,9 +2764,6 @@ class QuicStream extends Duplex {
}

_read(nread) {
if (this.pending)
return this.once('ready', () => this._read(nread));

if (this.destroyed) { // TODO(addaleax): Can this happen?
this.push(null);
return;
Expand Down Expand Up @@ -2848,12 +2813,6 @@ class QuicStream extends Duplex {
else if (typeof fd !== 'number')
throw new ERR_INVALID_ARG_TYPE('fd', ['number', 'FileHandle'], fd);

if (this.pending) {
return this.once('ready', () => {
this.sendFD(fd, { offset, length }, ownsFd);
});
}

this[kUpdateTimer]();
this.ownsFd = ownsFd;

Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-quic-client-server.js
Expand Up @@ -170,7 +170,6 @@ client.on('close', common.mustCall(onSocketClose.bind(client)));
assert(!stream.unidirectional);
assert(stream.clientInitiated);
assert(!stream.serverInitiated);
assert(!stream.pending);

const file = fs.createReadStream(__filename);
let data = '';
Expand Down

0 comments on commit a65296d

Please sign in to comment.