File tree 3 files changed +13
-5
lines changed
3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -162,6 +162,8 @@ connections use asynchronous `server.getConnections` instead.
162
162
added: v0.9.7
163
163
-->
164
164
165
+ * Returns {net.Server}
166
+
165
167
Asynchronously get the number of concurrent connections on the server. Works
166
168
when sockets were sent to forks.
167
169
Original file line number Diff line number Diff line change @@ -1550,7 +1550,8 @@ Server.prototype.getConnections = function(cb) {
1550
1550
}
1551
1551
1552
1552
if ( ! this . _usingSlaves ) {
1553
- return end ( null , this . _connections ) ;
1553
+ end ( null , this . _connections ) ;
1554
+ return this ;
1554
1555
}
1555
1556
1556
1557
// Poll slaves
@@ -1570,6 +1571,8 @@ Server.prototype.getConnections = function(cb) {
1570
1571
for ( var n = 0 ; n < this . _slaves . length ; n ++ ) {
1571
1572
this . _slaves [ n ] . getConnections ( oncount ) ;
1572
1573
}
1574
+
1575
+ return this ;
1573
1576
} ;
1574
1577
1575
1578
Original file line number Diff line number Diff line change @@ -37,10 +37,13 @@ function pingPongTest(port, host) {
37
37
38
38
function onSocket ( socket ) {
39
39
assert . strictEqual ( socket . server , server ) ;
40
- server . getConnections ( common . mustCall ( function ( err , connections ) {
41
- assert . ifError ( err ) ;
42
- assert . strictEqual ( connections , 1 ) ;
43
- } ) ) ;
40
+ assert . strictEqual (
41
+ server ,
42
+ server . getConnections ( common . mustCall ( function ( err , connections ) {
43
+ assert . ifError ( err ) ;
44
+ assert . strictEqual ( connections , 1 ) ;
45
+ } ) )
46
+ ) ;
44
47
45
48
socket . setNoDelay ( ) ;
46
49
socket . timeout = 0 ;
You can’t perform that action at this time.
0 commit comments