From fa0a87a0c78bc467e7352395278c1dd480b2f9af Mon Sep 17 00:00:00 2001 From: Georg Hopp Date: Sun, 31 Aug 2014 20:07:01 +0100 Subject: [PATCH] limit amount of accepts in one event to 100. This value might become configurable in future --- src/connector.c | 3 ++- testers/testclient.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/connector.c b/src/connector.c index ec6b95e..9196ae8 100644 --- a/src/connector.c +++ b/src/connector.c @@ -53,12 +53,13 @@ static TR_EventDone connectorAccept(void * _this, TR_Event event) { + int count = 0; TR_Connector this = _this; TR_CommEndPoint connection = (TR_CommEndPoint)event->subject; TR_TcpSocket socket = TR_socketAccept( (TR_TcpSocket)connection->transport); - while (socket) { + while (socket && count++ < 100) { TR_socketNonblock((TR_Socket)socket); TR_Connection new_con = TR_new( TR_Connection, diff --git a/testers/testclient.sh b/testers/testclient.sh index be3e8d9..50aac64 100755 --- a/testers/testclient.sh +++ b/testers/testclient.sh @@ -2,7 +2,7 @@ pids="" i=0 -while [ $i -lt 120 ] +while [ $i -lt 800 ] do dd if=/dev/zero bs=8192 count=2500 | nc 192.168.2.13 5678 & pids="${pids} $!"