File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed
Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -295,6 +295,7 @@ function TLSSocket(socket, options) {
295295 this . alpnProtocol = null ;
296296 this . authorized = false ;
297297 this . authorizationError = null ;
298+ this [ kRes ] = null ;
298299
299300 // Wrap plain JS Stream into StreamWrap
300301 var wrap ;
@@ -409,20 +410,25 @@ TLSSocket.prototype._wrapHandle = function(wrap) {
409410 res . _secureContext = context ;
410411 res . reading = handle . reading ;
411412 this [ kRes ] = res ;
412- Object . defineProperty ( handle , 'reading' , {
413- get : ( ) => {
414- return this [ kRes ] . reading ;
415- } ,
416- set : ( value ) => {
417- this [ kRes ] . reading = value ;
418- }
419- } ) ;
413+ defineHandleReading ( this , handle ) ;
420414
421415 this . on ( 'close' , onSocketCloseDestroySSL ) ;
422416
423417 return res ;
424418} ;
425419
420+ // This eliminates a cyclic reference to TLSWrap
421+ // Ref: https://github.com/nodejs/node/commit/f7620fb96d339f704932f9bb9a0dceb9952df2d4
422+ function defineHandleReading ( socket , handle ) {
423+ Object . defineProperty ( handle , 'reading' , {
424+ get : ( ) => {
425+ return socket [ kRes ] . reading ;
426+ } ,
427+ set : ( value ) => {
428+ socket [ kRes ] . reading = value ;
429+ }
430+ } ) ;
431+ }
426432
427433function onSocketCloseDestroySSL ( ) {
428434 // Make sure we are not doing it on OpenSSL's stack
You can’t perform that action at this time.
0 commit comments