@@ -69,7 +69,7 @@ const handleConversion = {
69
69
// the slave should keep track of the socket
70
70
message . key = socket . server . _connectionKey ;
71
71
72
- var firstTime = ! this . _channel . sockets . send [ message . key ] ;
72
+ var firstTime = ! this . channel . sockets . send [ message . key ] ;
73
73
var socketList = getSocketList ( 'send' , this , message . key ) ;
74
74
75
75
// the server should no longer expose a .connection property
@@ -409,7 +409,15 @@ ChildProcess.prototype.unref = function() {
409
409
410
410
411
411
function 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
+
413
421
target . _handleQueue = null ;
414
422
target . _pendingHandle = null ;
415
423
@@ -465,7 +473,7 @@ function setupChannel(target, channel) {
465
473
target . disconnect ( ) ;
466
474
channel . onread = nop ;
467
475
channel . close ( ) ;
468
- target . _channel = null ;
476
+ target . channel = null ;
469
477
maybeClose ( target ) ;
470
478
}
471
479
} ;
@@ -491,7 +499,7 @@ function setupChannel(target, channel) {
491
499
} ) ;
492
500
493
501
// Process a pending disconnect (if any).
494
- if ( ! target . connected && target . _channel && ! target . _handleQueue )
502
+ if ( ! target . connected && target . channel && ! target . _handleQueue )
495
503
target . _disconnect ( ) ;
496
504
497
505
return ;
@@ -547,7 +555,7 @@ function setupChannel(target, channel) {
547
555
} ;
548
556
549
557
target . _send = function ( message , handle , options , callback ) {
550
- assert ( this . connected || this . _channel ) ;
558
+ assert ( this . connected || this . channel ) ;
551
559
552
560
if ( message === undefined )
553
561
throw new TypeError ( '"message" argument cannot be undefined' ) ;
@@ -667,11 +675,11 @@ function setupChannel(target, channel) {
667
675
// connected will be set to false immediately when a disconnect() is
668
676
// requested, even though the channel might still be alive internally to
669
677
// 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
671
679
// is true
672
- // - disconnect() requested, messages in the queue: _channel is not null
680
+ // - disconnect() requested, messages in the queue: channel is not null
673
681
// and connected is false
674
- // - disconnect() requested, channel actually disconnected: _channel is
682
+ // - disconnect() requested, channel actually disconnected: channel is
675
683
// null and connected is false
676
684
target . connected = true ;
677
685
@@ -692,10 +700,10 @@ function setupChannel(target, channel) {
692
700
} ;
693
701
694
702
target . _disconnect = function ( ) {
695
- assert ( this . _channel ) ;
703
+ assert ( this . channel ) ;
696
704
697
705
// This marks the fact that the channel is actually disconnected.
698
- this . _channel = null ;
706
+ this . channel = null ;
699
707
700
708
if ( this . _pendingHandle ) {
701
709
this . _pendingHandle . close ( ) ;
@@ -729,7 +737,7 @@ function setupChannel(target, channel) {
729
737
730
738
const INTERNAL_PREFIX = 'NODE_' ;
731
739
function handleMessage ( target , message , handle ) {
732
- if ( ! target . _channel )
740
+ if ( ! target . channel )
733
741
return ;
734
742
735
743
var eventName = 'message' ;
@@ -860,7 +868,7 @@ function _validateStdio(stdio, sync) {
860
868
861
869
862
870
function getSocketList ( type , slave , key ) {
863
- var sockets = slave . _channel . sockets [ type ] ;
871
+ var sockets = slave . channel . sockets [ type ] ;
864
872
var socketList = sockets [ key ] ;
865
873
if ( ! socketList ) {
866
874
var Construct = type === 'send' ? SocketListSend : SocketListReceive ;
0 commit comments