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 @@ -121,6 +121,8 @@ connections use asynchronous `server.getConnections` instead.
121
121
added: v0.9.7
122
122
-->
123
123
124
+ * Returns {net.Server}
125
+
124
126
Asynchronously get the number of concurrent connections on the server. Works
125
127
when sockets were sent to forks.
126
128
Original file line number Diff line number Diff line change @@ -1487,7 +1487,8 @@ Server.prototype.getConnections = function(cb) {
1487
1487
}
1488
1488
1489
1489
if ( ! this . _usingSlaves ) {
1490
- return end ( null , this . _connections ) ;
1490
+ end ( null , this . _connections ) ;
1491
+ return this ;
1491
1492
}
1492
1493
1493
1494
// Poll slaves
@@ -1507,6 +1508,8 @@ Server.prototype.getConnections = function(cb) {
1507
1508
this . _slaves . forEach ( function ( slave ) {
1508
1509
slave . getConnections ( oncount ) ;
1509
1510
} ) ;
1511
+
1512
+ return this ;
1510
1513
} ;
1511
1514
1512
1515
Original file line number Diff line number Diff line change @@ -16,10 +16,13 @@ function pingPongTest(port, host) {
16
16
17
17
function onSocket ( socket ) {
18
18
assert . strictEqual ( socket . server , server ) ;
19
- server . getConnections ( common . mustCall ( function ( err , connections ) {
20
- assert . ifError ( err ) ;
21
- assert . strictEqual ( connections , 1 ) ;
22
- } ) ) ;
19
+ assert . strictEqual (
20
+ server ,
21
+ server . getConnections ( common . mustCall ( function ( err , connections ) {
22
+ assert . ifError ( err ) ;
23
+ assert . strictEqual ( connections , 1 ) ;
24
+ } ) )
25
+ ) ;
23
26
24
27
socket . setNoDelay ( ) ;
25
28
socket . timeout = 0 ;
You can’t perform that action at this time.
0 commit comments