Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
net_uv: Add maxConnections support
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryRawas authored and ry committed Jul 14, 2011
1 parent a3e3ad4 commit 8adc6b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ test-uv: all
simple/test-net-pingpong \
simple/test-net-reconnect \
simple/test-net-remote-address-port \
simple/test-net-server-max-connections \
simple/test-net-server-try-ports \
simple/test-net-stream \
simple/test-net-socket-timeout \
Expand Down
5 changes: 5 additions & 0 deletions lib/net_uv.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,11 @@ function onconnection(clientHandle) {

debug("onconnection");

if (self.maxConnections && self.connections >= self.maxConnections) {
clientHandle.close();
return;
}

var socket = new Socket({
handle: clientHandle,
allowHalfOpen: self.allowHalfOpen
Expand Down

0 comments on commit 8adc6b8

Please sign in to comment.