@@ -1187,7 +1187,7 @@ function Server(options, connectionListener) {
1187
1187
Object . defineProperty ( this , 'connections' , {
1188
1188
get : internalUtil . deprecate ( ( ) => {
1189
1189
1190
- if ( this . _usingSlaves ) {
1190
+ if ( this . _usingWorkers ) {
1191
1191
return null ;
1192
1192
}
1193
1193
return this . _connections ;
@@ -1201,8 +1201,8 @@ function Server(options, connectionListener) {
1201
1201
1202
1202
this [ async_id_symbol ] = - 1 ;
1203
1203
this . _handle = null ;
1204
- this . _usingSlaves = false ;
1205
- this . _slaves = [ ] ;
1204
+ this . _usingWorkers = false ;
1205
+ this . _workers = [ ] ;
1206
1206
this . _unref = false ;
1207
1207
1208
1208
this . allowHalfOpen = options . allowHalfOpen || false ;
@@ -1555,13 +1555,13 @@ Server.prototype.getConnections = function(cb) {
1555
1555
nextTick ( asyncId , cb , err , connections ) ;
1556
1556
}
1557
1557
1558
- if ( ! this . _usingSlaves ) {
1558
+ if ( ! this . _usingWorkers ) {
1559
1559
end ( null , this . _connections ) ;
1560
1560
return this ;
1561
1561
}
1562
1562
1563
- // Poll slaves
1564
- var left = this . _slaves . length ;
1563
+ // Poll workers
1564
+ var left = this . _workers . length ;
1565
1565
var total = this . _connections ;
1566
1566
1567
1567
function oncount ( err , count ) {
@@ -1574,8 +1574,8 @@ Server.prototype.getConnections = function(cb) {
1574
1574
if ( -- left === 0 ) return end ( null , total ) ;
1575
1575
}
1576
1576
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 ) ;
1579
1579
}
1580
1580
1581
1581
return this ;
@@ -1598,22 +1598,22 @@ Server.prototype.close = function(cb) {
1598
1598
this . _handle = null ;
1599
1599
}
1600
1600
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 = ( ) => {
1604
1604
if ( -- left !== 0 ) return ;
1605
1605
1606
1606
this . _connections = 0 ;
1607
1607
this . _emitCloseIfDrained ( ) ;
1608
1608
} ;
1609
1609
1610
1610
// 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.
1612
1612
this . _connections ++ ;
1613
1613
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 ) ;
1617
1617
} else {
1618
1618
this . _emitCloseIfDrained ( ) ;
1619
1619
}
@@ -1646,9 +1646,9 @@ Server.prototype.listenFD = internalUtil.deprecate(function(fd, type) {
1646
1646
} , 'Server.listenFD is deprecated. Use Server.listen({fd: <number>}) instead.' ,
1647
1647
'DEP0021' ) ;
1648
1648
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 ) ;
1652
1652
} ;
1653
1653
1654
1654
Server . prototype . ref = function ( ) {
@@ -1693,6 +1693,34 @@ if (process.platform === 'win32') {
1693
1693
_setSimultaneousAccepts = function ( handle ) { } ;
1694
1694
}
1695
1695
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
+
1696
1724
module . exports = {
1697
1725
_createServerHandle : createServerHandle ,
1698
1726
_normalizeArgs : normalizeArgs ,
0 commit comments