@@ -22,55 +22,15 @@ const kCurrentWriteRequest = Symbol('kCurrentWriteRequest');
22
22
const kCurrentShutdownRequest = Symbol ( 'kCurrentShutdownRequest' ) ;
23
23
const kPendingShutdownRequest = Symbol ( 'kPendingShutdownRequest' ) ;
24
24
25
- function isClosing ( ) {
26
- let socket = this [ owner_symbol ] ;
25
+ function isClosing ( ) { return this [ owner_symbol ] . isClosing ( ) ; }
27
26
28
- if ( socket . constructor . name === 'ReusedHandle' ) {
29
- socket = socket . handle ;
30
- }
31
-
32
- return socket . isClosing ( ) ;
33
- }
34
-
35
- function onreadstart ( ) {
36
- let socket = this [ owner_symbol ] ;
37
-
38
- if ( socket . constructor . name === 'ReusedHandle' ) {
39
- socket = socket . handle ;
40
- }
41
-
42
- return socket . readStart ( ) ;
43
- }
44
-
45
- function onreadstop ( ) {
46
- let socket = this [ owner_symbol ] ;
47
-
48
- if ( socket . constructor . name === 'ReusedHandle' ) {
49
- socket = socket . handle ;
50
- }
51
-
52
- return socket . readStop ( ) ;
53
- }
54
-
55
- function onshutdown ( req ) {
56
- let socket = this [ owner_symbol ] ;
57
-
58
- if ( socket . constructor . name === 'ReusedHandle' ) {
59
- socket = socket . handle ;
60
- }
27
+ function onreadstart ( ) { return this [ owner_symbol ] . readStart ( ) ; }
61
28
62
- return socket . doShutdown ( req ) ;
63
- }
29
+ function onreadstop ( ) { return this [ owner_symbol ] . readStop ( ) ; }
64
30
65
- function onwrite ( req , bufs ) {
66
- let socket = this [ owner_symbol ] ;
31
+ function onshutdown ( req ) { return this [ owner_symbol ] . doShutdown ( req ) ; }
67
32
68
- if ( socket . constructor . name === 'ReusedHandle' ) {
69
- socket = socket . handle ;
70
- }
71
-
72
- return socket . doWrite ( req , bufs ) ;
73
- }
33
+ function onwrite ( req , bufs ) { return this [ owner_symbol ] . doWrite ( req , bufs ) ; }
74
34
75
35
/* This class serves as a wrapper for when the C++ side of Node wants access
76
36
* to a standard JS stream. For example, TLS or HTTP do not operate on network
0 commit comments