Commit b148346924845d720cc4d84ffc046aec4c4bd363
1 parent
fa0a87a0
fix mishandling of accept limit that caused a memory leak.
Showing
1 changed file
with
2 additions
and
14 deletions
@@ -59,7 +59,7 @@ connectorAccept(void * _this, TR_Event event) | @@ -59,7 +59,7 @@ connectorAccept(void * _this, TR_Event event) | ||
59 | TR_TcpSocket socket = TR_socketAccept( | 59 | TR_TcpSocket socket = TR_socketAccept( |
60 | (TR_TcpSocket)connection->transport); | 60 | (TR_TcpSocket)connection->transport); |
61 | 61 | ||
62 | - while (socket && count++ < 100) { | 62 | + while (socket) { |
63 | TR_socketNonblock((TR_Socket)socket); | 63 | TR_socketNonblock((TR_Socket)socket); |
64 | TR_Connection new_con = TR_new( | 64 | TR_Connection new_con = TR_new( |
65 | TR_Connection, | 65 | TR_Connection, |
@@ -72,22 +72,10 @@ connectorAccept(void * _this, TR_Event event) | @@ -72,22 +72,10 @@ connectorAccept(void * _this, TR_Event event) | ||
72 | (TR_EventSubject)new_con, | 72 | (TR_EventSubject)new_con, |
73 | TR_CON_EVENT_NEW_CON, | 73 | TR_CON_EVENT_NEW_CON, |
74 | NULL)); | 74 | NULL)); |
75 | + if (++count > 100) break; | ||
75 | socket = TR_socketAccept((TR_TcpSocket)connection->transport); | 76 | socket = TR_socketAccept((TR_TcpSocket)connection->transport); |
76 | } | 77 | } |
77 | 78 | ||
78 | - /* | ||
79 | - * reenable socket for poll | ||
80 | - */ | ||
81 | - TR_eventHandlerIssueEvent( | ||
82 | - (TR_EventHandler)_this, | ||
83 | - TR_eventSubjectEmit( | ||
84 | - (TR_EventSubject)connection, | ||
85 | - TR_CEP_EVENT_READ_BLOCK, | ||
86 | - NULL)); | ||
87 | - /** | ||
88 | - * TODO we need to identify socket failures and close socket then. | ||
89 | - */ | ||
90 | - | ||
91 | return TR_EVENT_DONE; | 79 | return TR_EVENT_DONE; |
92 | } | 80 | } |
93 | 81 |
Please
register
or
login
to post a comment