Skip to content

Commit 8d0913b

Browse files
pimterryUlisesGascon
authored andcommittedSep 10, 2023
net: use asserts in JS Socket Stream to catch races in future
PR-URL: #49400 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 2486836 commit 8d0913b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed
 

‎lib/internal/js_stream_socket.js

+3
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ class JSStreamSocket extends Socket {
149149
}
150150

151151
const handle = this._handle;
152+
assert(handle !== null);
152153

153154
process.nextTick(() => {
154155
// Ensure that write is dispatched asynchronously.
@@ -181,6 +182,8 @@ class JSStreamSocket extends Socket {
181182
}
182183

183184
const handle = this._handle;
185+
assert(handle !== null);
186+
184187
const self = this;
185188

186189
let pending = bufs.length;

0 commit comments

Comments
 (0)
Please sign in to comment.