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 @@ -1558,7 +1558,8 @@ Server.prototype.getConnections = function(cb) {
1558
1558
}
1559
1559
1560
1560
if ( ! this . _usingSlaves ) {
1561
- return end ( null , this . _connections ) ;
1561
+ end ( null , this . _connections ) ;
1562
+ return this ;
1562
1563
}
1563
1564
1564
1565
// Poll slaves
@@ -1578,6 +1579,8 @@ Server.prototype.getConnections = function(cb) {
1578
1579
for ( var n = 0 ; n < this . _slaves . length ; n ++ ) {
1579
1580
this . _slaves [ n ] . getConnections ( oncount ) ;
1580
1581
}
1582
+
1583
+ return this ;
1581
1584
} ;
1582
1585
1583
1586
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