mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
Revert "lib: use helper for readability"
This reverts commit 937bbc5571.
PR-URL: https://github.com/nodejs/node/pull/40741
Fixes: https://github.com/nodejs/node/issues/40693
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit is contained in:
1 parent
48e2b60c44
commit
4bcff4c5f8
1 file changed
+25
-14
@@ -22,41 +22,52 @@ const kCurrentWriteRequest = Symbol('kCurrentWriteRequest');
|
||||
const kCurrentShutdownRequest = Symbol('kCurrentShutdownRequest');
|
||||
const kPendingShutdownRequest = Symbol('kPendingShutdownRequest');
|
||||
|
||||
function checkReusedHandle(self) {
|
||||
let socket = self[owner_symbol];
|
||||
|
||||
if (socket.constructor.name === 'ReusedHandle')
|
||||
socket = socket.handle;
|
||||
|
||||
return socket;
|
||||
}
|
||||
|
||||
function isClosing() {
|
||||
const socket = checkReusedHandle(this);
|
||||
let socket = this[owner_symbol];
|
||||
|
||||
if (socket.constructor.name === 'ReusedHandle') {
|
||||
socket = socket.handle;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user