Skip to content

Commit

Permalink
Revert "lib: use helper for readability"
Browse files Browse the repository at this point in the history
This reverts commit 937bbc5.

PR-URL: #40741
Fixes: #40693
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
  • Loading branch information
RaisinTen authored and danielleadams committed Jan 30, 2022
1 parent d4b632e commit e2af370
Showing 1 changed file with 24 additions and 13 deletions.
37 changes: 24 additions & 13 deletions lib/internal/js_stream_socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,52 @@ const kCurrentWriteRequest = Symbol('kCurrentWriteRequest');
const kCurrentShutdownRequest = Symbol('kCurrentShutdownRequest');
const kPendingShutdownRequest = Symbol('kPendingShutdownRequest');

function checkReusedHandle(self) {
let socket = self[owner_symbol];
function isClosing() {
let socket = this[owner_symbol];

if (socket.constructor.name === 'ReusedHandle')
if (socket.constructor.name === 'ReusedHandle') {
socket = socket.handle;

return socket;
}

function isClosing() {
const socket = checkReusedHandle(this);
}

return socket.isClosing();
}

function onreadstart() {
const socket = checkReusedHandle(this);
let socket = this[owner_symbol];

if (socket.constructor.name === 'ReusedHandle') {
socket = socket.handle;
}

return socket.readStart();
}

function onreadstop() {
const socket = checkReusedHandle(this);
let socket = this[owner_symbol];

if (socket.constructor.name === 'ReusedHandle') {
socket = socket.handle;
}

return socket.readStop();
}

function onshutdown(req) {
const socket = checkReusedHandle(this);
let socket = this[owner_symbol];

if (socket.constructor.name === 'ReusedHandle') {
socket = socket.handle;
}

return socket.doShutdown(req);
}

function onwrite(req, bufs) {
const socket = checkReusedHandle(this);
let socket = this[owner_symbol];

if (socket.constructor.name === 'ReusedHandle') {
socket = socket.handle;
}

return socket.doWrite(req, bufs);
}
Expand Down

0 comments on commit e2af370

Please sign in to comment.