Skip to content

Commit

Permalink
net: use asserts in JS Socket Stream to catch races in future
Browse files Browse the repository at this point in the history
PR-URL: #49400
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
pimterry authored and UlisesGascon committed Sep 10, 2023
1 parent 2486836 commit 8d0913b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/internal/js_stream_socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ class JSStreamSocket extends Socket {
}

const handle = this._handle;
assert(handle !== null);

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

const handle = this._handle;
assert(handle !== null);

const self = this;

let pending = bufs.length;
Expand Down

0 comments on commit 8d0913b

Please sign in to comment.