@@ -22,15 +22,55 @@ const kCurrentWriteRequest = Symbol('kCurrentWriteRequest');
22
22
const kCurrentShutdownRequest = Symbol ( 'kCurrentShutdownRequest' ) ;
23
23
const kPendingShutdownRequest = Symbol ( 'kPendingShutdownRequest' ) ;
24
24
25
- function isClosing ( ) { return this [ owner_symbol ] . isClosing ( ) ; }
25
+ function isClosing ( ) {
26
+ let socket = this [ owner_symbol ] ;
26
27
27
- function onreadstart ( ) { return this [ owner_symbol ] . readStart ( ) ; }
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
+ }
28
61
29
- function onreadstop ( ) { return this [ owner_symbol ] . readStop ( ) ; }
62
+ return socket . doShutdown ( req ) ;
63
+ }
30
64
31
- function onshutdown ( req ) { return this [ owner_symbol ] . doShutdown ( req ) ; }
65
+ function onwrite ( req , bufs ) {
66
+ let socket = this [ owner_symbol ] ;
32
67
33
- function onwrite ( req , bufs ) { return this [ owner_symbol ] . doWrite ( req , bufs ) ; }
68
+ if ( socket . constructor . name === 'ReusedHandle' ) {
69
+ socket = socket . handle ;
70
+ }
71
+
72
+ return socket . doWrite ( req , bufs ) ;
73
+ }
34
74
35
75
/* This class serves as a wrapper for when the C++ side of Node wants access
36
76
* to a standard JS stream. For example, TLS or HTTP do not operate on network
0 commit comments