From b148346924845d720cc4d84ffc046aec4c4bd363 Mon Sep 17 00:00:00 2001 From: Georg Hopp Date: Wed, 3 Sep 2014 19:53:16 +0100 Subject: [PATCH] fix mishandling of accept limit that caused a memory leak. --- src/connector.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/connector.c b/src/connector.c index 9196ae8..7652811 100644 --- a/src/connector.c +++ b/src/connector.c @@ -59,7 +59,7 @@ connectorAccept(void * _this, TR_Event event) TR_TcpSocket socket = TR_socketAccept( (TR_TcpSocket)connection->transport); - while (socket && count++ < 100) { + while (socket) { TR_socketNonblock((TR_Socket)socket); TR_Connection new_con = TR_new( TR_Connection, @@ -72,22 +72,10 @@ connectorAccept(void * _this, TR_Event event) (TR_EventSubject)new_con, TR_CON_EVENT_NEW_CON, NULL)); + if (++count > 100) break; socket = TR_socketAccept((TR_TcpSocket)connection->transport); } - /* - * reenable socket for poll - */ - TR_eventHandlerIssueEvent( - (TR_EventHandler)_this, - TR_eventSubjectEmit( - (TR_EventSubject)connection, - TR_CEP_EVENT_READ_BLOCK, - NULL)); - /** - * TODO we need to identify socket failures and close socket then. - */ - return TR_EVENT_DONE; }