@@ -22,15 +22,55 @@ const kCurrentWriteRequest = Symbol('kCurrentWriteRequest');
2222const kCurrentShutdownRequest = Symbol ( 'kCurrentShutdownRequest' ) ;
2323const kPendingShutdownRequest = Symbol ( 'kPendingShutdownRequest' ) ;
2424
25- function isClosing ( ) { return this [ owner_symbol ] . isClosing ( ) ; }
25+ function isClosing ( ) {
26+ let socket = this [ owner_symbol ] ;
2627
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+ }
2861
29- function onreadstop ( ) { return this [ owner_symbol ] . readStop ( ) ; }
62+ return socket . doShutdown ( req ) ;
63+ }
3064
31- function onshutdown ( req ) { return this [ owner_symbol ] . doShutdown ( req ) ; }
65+ function onwrite ( req , bufs ) {
66+ let socket = this [ owner_symbol ] ;
3267
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+ }
3474
3575/* This class serves as a wrapper for when the C++ side of Node wants access
3676 * to a standard JS stream. For example, TLS or HTTP do not operate on network
0 commit comments