@@ -1187,7 +1187,7 @@ function Server(options, connectionListener) {
11871187 Object . defineProperty ( this , 'connections' , {
11881188 get : internalUtil . deprecate ( ( ) => {
11891189
1190- if ( this . _usingSlaves ) {
1190+ if ( this . _usingWorkers ) {
11911191 return null ;
11921192 }
11931193 return this . _connections ;
@@ -1201,8 +1201,8 @@ function Server(options, connectionListener) {
12011201
12021202 this [ async_id_symbol ] = - 1 ;
12031203 this . _handle = null ;
1204- this . _usingSlaves = false ;
1205- this . _slaves = [ ] ;
1204+ this . _usingWorkers = false ;
1205+ this . _workers = [ ] ;
12061206 this . _unref = false ;
12071207
12081208 this . allowHalfOpen = options . allowHalfOpen || false ;
@@ -1555,13 +1555,13 @@ Server.prototype.getConnections = function(cb) {
15551555 nextTick ( asyncId , cb , err , connections ) ;
15561556 }
15571557
1558- if ( ! this . _usingSlaves ) {
1558+ if ( ! this . _usingWorkers ) {
15591559 end ( null , this . _connections ) ;
15601560 return this ;
15611561 }
15621562
1563- // Poll slaves
1564- var left = this . _slaves . length ;
1563+ // Poll workers
1564+ var left = this . _workers . length ;
15651565 var total = this . _connections ;
15661566
15671567 function oncount ( err , count ) {
@@ -1574,8 +1574,8 @@ Server.prototype.getConnections = function(cb) {
15741574 if ( -- left === 0 ) return end ( null , total ) ;
15751575 }
15761576
1577- for ( var n = 0 ; n < this . _slaves . length ; n ++ ) {
1578- this . _slaves [ n ] . getConnections ( oncount ) ;
1577+ for ( var n = 0 ; n < this . _workers . length ; n ++ ) {
1578+ this . _workers [ n ] . getConnections ( oncount ) ;
15791579 }
15801580
15811581 return this ;
@@ -1598,22 +1598,22 @@ Server.prototype.close = function(cb) {
15981598 this . _handle = null ;
15991599 }
16001600
1601- if ( this . _usingSlaves ) {
1602- var left = this . _slaves . length ;
1603- const onSlaveClose = ( ) => {
1601+ if ( this . _usingWorkers ) {
1602+ var left = this . _workers . length ;
1603+ const onWorkerClose = ( ) => {
16041604 if ( -- left !== 0 ) return ;
16051605
16061606 this . _connections = 0 ;
16071607 this . _emitCloseIfDrained ( ) ;
16081608 } ;
16091609
16101610 // Increment connections to be sure that, even if all sockets will be closed
1611- // during polling of slaves , `close` event will be emitted only once.
1611+ // during polling of workers , `close` event will be emitted only once.
16121612 this . _connections ++ ;
16131613
1614- // Poll slaves
1615- for ( var n = 0 ; n < this . _slaves . length ; n ++ )
1616- this . _slaves [ n ] . close ( onSlaveClose ) ;
1614+ // Poll workers
1615+ for ( var n = 0 ; n < this . _workers . length ; n ++ )
1616+ this . _workers [ n ] . close ( onWorkerClose ) ;
16171617 } else {
16181618 this . _emitCloseIfDrained ( ) ;
16191619 }
@@ -1646,9 +1646,9 @@ Server.prototype.listenFD = internalUtil.deprecate(function(fd, type) {
16461646} , 'Server.listenFD is deprecated. Use Server.listen({fd: <number>}) instead.' ,
16471647 'DEP0021' ) ;
16481648
1649- Server . prototype . _setupSlave = function ( socketList ) {
1650- this . _usingSlaves = true ;
1651- this . _slaves . push ( socketList ) ;
1649+ Server . prototype . _setupWorker = function ( socketList ) {
1650+ this . _usingWorkers = true ;
1651+ this . _workers . push ( socketList ) ;
16521652} ;
16531653
16541654Server . prototype . ref = function ( ) {
@@ -1693,6 +1693,34 @@ if (process.platform === 'win32') {
16931693 _setSimultaneousAccepts = function ( handle ) { } ;
16941694}
16951695
1696+ // TODO(addaleax): Remove these after the Node 9.x branch cut.
1697+ Object . defineProperty ( Server . prototype , '_usingSlaves' , {
1698+ get : internalUtil . deprecate ( function ( ) {
1699+ return this . _usingWorkers ;
1700+ } , 'Accessing internal properties of net.Server is deprecated.' , 'DEP00XX' ) ,
1701+ set : internalUtil . deprecate ( ( val ) => {
1702+ this . _usingWorkers = val ;
1703+ } , 'Accessing internal properties of net.Server is deprecated.' , 'DEP00XX' ) ,
1704+ configurable : true , enumerable : false
1705+ } ) ;
1706+
1707+ Object . defineProperty ( Server . prototype , '_slaves' , {
1708+ get : internalUtil . deprecate ( function ( ) {
1709+ return this . _workers ;
1710+ } , 'Accessing internal properties of net.Server is deprecated.' , 'DEP00XX' ) ,
1711+ set : internalUtil . deprecate ( ( val ) => {
1712+ this . _workers = val ;
1713+ } , 'Accessing internal properties of net.Server is deprecated.' , 'DEP00XX' ) ,
1714+ configurable : true , enumerable : false
1715+ } ) ;
1716+
1717+ Object . defineProperty ( Server . prototype , '_setupSlave' , {
1718+ value : internalUtil . deprecate ( function ( socketList ) {
1719+ return this . _setupWorker ( socketList ) ;
1720+ } , 'Accessing internal properties of net.Server is deprecated.' , 'DEP00XX' ) ,
1721+ configurable : true , enumerable : false
1722+ } ) ;
1723+
16961724module . exports = {
16971725 _createServerHandle : createServerHandle ,
16981726 _normalizeArgs : normalizeArgs ,
0 commit comments