only accept 100 connection in one round to remove the starvation of waiting connections

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@732 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.6
Jan Kneschke 2005-09-23 16:31:49 +00:00
parent 5e2a796a19
commit b46fa4497b
1 changed files with 6 additions and 2 deletions

View File

@ -30,6 +30,7 @@ handler_t network_server_handle_fdevent(void *s, void *context, int revents) {
server *srv = (server *)s;
server_socket *srv_socket = (server_socket *)context;
connection *con;
int loops = 0;
UNUSED(context);
@ -40,8 +41,11 @@ handler_t network_server_handle_fdevent(void *s, void *context, int revents) {
revents);
return HANDLER_ERROR;
}
while (NULL != (con = connection_accept(srv, srv_socket))) {
/* accept()s at most 100 connections directly
*
* we jump out after 100 to give the waiting connections a chance */
for (loops = 0; loops < 100 && NULL != (con = connection_accept(srv, srv_socket)); loops++) {
handler_t r;
connection_state_machine(srv, con);