Skip to content

Commit b614b17

Browse files
RaisinTentargos
authored andcommitted
Revert "lib: use helper for readability"
This reverts commit 937bbc5. PR-URL: #40741 Fixes: #40693 Reviewed-By: Stephen Belanger <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
1 parent 43e8650 commit b614b17

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

lib/internal/js_stream_socket.js

+24-13
Original file line numberDiff line numberDiff line change
@@ -22,41 +22,52 @@ const kCurrentWriteRequest = Symbol('kCurrentWriteRequest');
2222
const kCurrentShutdownRequest = Symbol('kCurrentShutdownRequest');
2323
const kPendingShutdownRequest = Symbol('kPendingShutdownRequest');
2424

25-
function checkReusedHandle(self) {
26-
let socket = self[owner_symbol];
25+
function isClosing() {
26+
let socket = this[owner_symbol];
2727

28-
if (socket.constructor.name === 'ReusedHandle')
28+
if (socket.constructor.name === 'ReusedHandle') {
2929
socket = socket.handle;
30-
31-
return socket;
32-
}
33-
34-
function isClosing() {
35-
const socket = checkReusedHandle(this);
30+
}
3631

3732
return socket.isClosing();
3833
}
3934

4035
function onreadstart() {
41-
const socket = checkReusedHandle(this);
36+
let socket = this[owner_symbol];
37+
38+
if (socket.constructor.name === 'ReusedHandle') {
39+
socket = socket.handle;
40+
}
4241

4342
return socket.readStart();
4443
}
4544

4645
function onreadstop() {
47-
const socket = checkReusedHandle(this);
46+
let socket = this[owner_symbol];
47+
48+
if (socket.constructor.name === 'ReusedHandle') {
49+
socket = socket.handle;
50+
}
4851

4952
return socket.readStop();
5053
}
5154

5255
function onshutdown(req) {
53-
const socket = checkReusedHandle(this);
56+
let socket = this[owner_symbol];
57+
58+
if (socket.constructor.name === 'ReusedHandle') {
59+
socket = socket.handle;
60+
}
5461

5562
return socket.doShutdown(req);
5663
}
5764

5865
function onwrite(req, bufs) {
59-
const socket = checkReusedHandle(this);
66+
let socket = this[owner_symbol];
67+
68+
if (socket.constructor.name === 'ReusedHandle') {
69+
socket = socket.handle;
70+
}
6071

6172
return socket.doWrite(req, bufs);
6273
}

0 commit comments

Comments
 (0)