Skip to content

Commit 6b0b33c

Browse files
committed
quic: cleanup some outstanding todo items
PR-URL: #34618 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent b0e4970 commit 6b0b33c

File tree

2 files changed

+20
-29
lines changed

2 files changed

+20
-29
lines changed

lib/internal/quic/core.js

+17-27
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ const kOnFileOpened = Symbol('kOnFileOpened');
225225
const kOnFileUnpipe = Symbol('kOnFileUnpipe');
226226
const kOnPipedFileHandleRead = Symbol('kOnPipedFileHandleRead');
227227
const kReady = Symbol('kReady');
228+
const kRemoveFromSocket = Symbol('kRemoveFromSocket');
228229
const kRemoveSession = Symbol('kRemove');
229230
const kRemoveStream = Symbol('kRemoveStream');
230231
const kServerBusy = Symbol('kServerBusy');
@@ -2247,9 +2248,7 @@ class QuicSession extends EventEmitter {
22472248
return this[kInternalState].handshakeContinuationHistogram;
22482249
}
22492250

2250-
// TODO(addaleax): This is a temporary solution for testing and should be
2251-
// removed later.
2252-
removeFromSocket() {
2251+
[kRemoveFromSocket]() {
22532252
return this[kHandle].removeFromSocket();
22542253
}
22552254
}
@@ -2695,7 +2694,17 @@ class QuicStream extends Duplex {
26952694
}
26962695

26972696
[kAfterAsyncWrite]({ bytes }) {
2698-
// TODO(@jasnell): Implement this
2697+
// There's currently nothing we need to do here. We have
2698+
// to have this but it's a non-op
2699+
}
2700+
2701+
[kUpdateTimer]() {
2702+
// Timeout is implemented in the QuicSession at the native
2703+
// layer. We have to have this here but it's a non-op
2704+
}
2705+
2706+
[kTrackWriteState](stream, bytes) {
2707+
// There's currently nothing to do here.
26992708
}
27002709

27012710
[kInspect](depth, options) {
@@ -2712,17 +2721,6 @@ class QuicStream extends Duplex {
27122721
}, depth, options);
27132722
}
27142723

2715-
[kTrackWriteState](stream, bytes) {
2716-
// TODO(@jasnell): Not yet sure what we want to do with these
2717-
// this.#writeQueueSize += bytes;
2718-
// this.#writeQueueSize += bytes;
2719-
// this[kHandle].chunksSentSinceLastWrite = 0;
2720-
}
2721-
2722-
[kUpdateTimer]() {
2723-
// TODO(@jasnell): Implement this later
2724-
}
2725-
27262724
get detached() {
27272725
// The QuicStream is detached if it is yet destroyed
27282726
// but the underlying handle is undefined. While in
@@ -2750,7 +2748,7 @@ class QuicStream extends Duplex {
27502748

27512749
[kWriteGeneric](writev, data, encoding, cb) {
27522750
if (this.destroyed || this.detached)
2753-
return; // TODO(addaleax): Can this happen?
2751+
return;
27542752

27552753
this[kUpdateTimer]();
27562754
const req = (writev) ?
@@ -2810,7 +2808,7 @@ class QuicStream extends Duplex {
28102808
}
28112809

28122810
_read(nread) {
2813-
if (this.destroyed) { // TODO(addaleax): Can this happen?
2811+
if (this.destroyed) {
28142812
this.push(null);
28152813
return;
28162814
}
@@ -2910,11 +2908,6 @@ class QuicStream extends Duplex {
29102908
undefined;
29112909
}
29122910

2913-
get bufferSize() {
2914-
// TODO(@jasnell): Implement this
2915-
return undefined;
2916-
}
2917-
29182911
get id() {
29192912
return this[kInternalState].id;
29202913
}
@@ -2923,10 +2916,6 @@ class QuicStream extends Duplex {
29232916
return this[kInternalState].push_id;
29242917
}
29252918

2926-
_onTimeout() {
2927-
// TODO(@jasnell): Implement this
2928-
}
2929-
29302919
get session() {
29312920
return this[kInternalState].session;
29322921
}
@@ -3127,7 +3116,8 @@ function createSocket(options) {
31273116

31283117
module.exports = {
31293118
createSocket,
3130-
kUDPHandleForTesting
3119+
kUDPHandleForTesting,
3120+
kRemoveFromSocket,
31313121
};
31323122

31333123
/* eslint-enable no-use-before-define */

test/parallel/test-quic-process-cleanup.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Flags: --no-warnings
1+
// Flags: --no-warnings --expose-internals
22
'use strict';
33
const common = require('../common');
44
if (!common.hasQuic)
@@ -8,6 +8,7 @@ if (!common.hasQuic)
88
// well. We use Workers because they have a more clearly defined shutdown
99
// sequence and we can stop execution at any point.
1010

11+
const { kRemoveFromSocket } = require('internal/quic/core');
1112
const { createQuicSocket } = require('net');
1213
const { Worker, workerData } = require('worker_threads');
1314

@@ -46,7 +47,7 @@ client.on('close', common.mustNotCall());
4647

4748
req.on('stream', common.mustCall(() => {
4849
if (workerData.removeFromSocket)
49-
req.removeFromSocket();
50+
req[kRemoveFromSocket]();
5051
process.exit(); // Exits the worker thread
5152
}));
5253

0 commit comments

Comments
 (0)