@@ -69,7 +69,7 @@ const handleConversion = {
6969 // the slave should keep track of the socket
7070 message . key = socket . server . _connectionKey ;
7171
72- var firstTime = ! this . _channel . sockets . send [ message . key ] ;
72+ var firstTime = ! this . channel . sockets . send [ message . key ] ;
7373 var socketList = getSocketList ( 'send' , this , message . key ) ;
7474
7575 // the server should no longer expose a .connection property
@@ -409,7 +409,15 @@ ChildProcess.prototype.unref = function() {
409409
410410
411411function setupChannel ( target , channel ) {
412- target . _channel = channel ;
412+ target . channel = channel ;
413+
414+ // _channel can be deprecated in version 8
415+ Object . defineProperty ( target , '_channel' , {
416+ get ( ) { return target . channel ; } ,
417+ set ( val ) { target . channel = val ; } ,
418+ enumerable : true
419+ } ) ;
420+
413421 target . _handleQueue = null ;
414422 target . _pendingHandle = null ;
415423
@@ -465,7 +473,7 @@ function setupChannel(target, channel) {
465473 target . disconnect ( ) ;
466474 channel . onread = nop ;
467475 channel . close ( ) ;
468- target . _channel = null ;
476+ target . channel = null ;
469477 maybeClose ( target ) ;
470478 }
471479 } ;
@@ -491,7 +499,7 @@ function setupChannel(target, channel) {
491499 } ) ;
492500
493501 // Process a pending disconnect (if any).
494- if ( ! target . connected && target . _channel && ! target . _handleQueue )
502+ if ( ! target . connected && target . channel && ! target . _handleQueue )
495503 target . _disconnect ( ) ;
496504
497505 return ;
@@ -547,7 +555,7 @@ function setupChannel(target, channel) {
547555 } ;
548556
549557 target . _send = function ( message , handle , options , callback ) {
550- assert ( this . connected || this . _channel ) ;
558+ assert ( this . connected || this . channel ) ;
551559
552560 if ( message === undefined )
553561 throw new TypeError ( '"message" argument cannot be undefined' ) ;
@@ -667,11 +675,11 @@ function setupChannel(target, channel) {
667675 // connected will be set to false immediately when a disconnect() is
668676 // requested, even though the channel might still be alive internally to
669677 // process queued messages. The three states are distinguished as follows:
670- // - disconnect() never requested: _channel is not null and connected
678+ // - disconnect() never requested: channel is not null and connected
671679 // is true
672- // - disconnect() requested, messages in the queue: _channel is not null
680+ // - disconnect() requested, messages in the queue: channel is not null
673681 // and connected is false
674- // - disconnect() requested, channel actually disconnected: _channel is
682+ // - disconnect() requested, channel actually disconnected: channel is
675683 // null and connected is false
676684 target . connected = true ;
677685
@@ -692,10 +700,10 @@ function setupChannel(target, channel) {
692700 } ;
693701
694702 target . _disconnect = function ( ) {
695- assert ( this . _channel ) ;
703+ assert ( this . channel ) ;
696704
697705 // This marks the fact that the channel is actually disconnected.
698- this . _channel = null ;
706+ this . channel = null ;
699707
700708 if ( this . _pendingHandle ) {
701709 this . _pendingHandle . close ( ) ;
@@ -729,7 +737,7 @@ function setupChannel(target, channel) {
729737
730738const INTERNAL_PREFIX = 'NODE_' ;
731739function handleMessage ( target , message , handle ) {
732- if ( ! target . _channel )
740+ if ( ! target . channel )
733741 return ;
734742
735743 var eventName = 'message' ;
@@ -860,7 +868,7 @@ function _validateStdio(stdio, sync) {
860868
861869
862870function getSocketList ( type , slave , key ) {
863- var sockets = slave . _channel . sockets [ type ] ;
871+ var sockets = slave . channel . sockets [ type ] ;
864872 var socketList = sockets [ key ] ;
865873 if ( ! socketList ) {
866874 var Construct = type === 'send' ? SocketListSend : SocketListReceive ;
0 commit comments