Browse Source

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 16 years ago
parent
commit
b46fa4497b
  1. 8
      src/network.c

8
src/network.c

@ -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);

Loading…
Cancel
Save