X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuhttpd.git;a=blobdiff_plain;f=listen.c;h=251a60e07eef53844056f075f33c5511368bc0e3;hp=c4b6b2bb9faeab050ade6e257e04f463bfd3908e;hb=b949545598eaa75b38b4d57c9aea6216bd82256c;hpb=8515c92b9302b258be10df5c5cee240dd4b137f6 diff --git a/listen.c b/listen.c index c4b6b2b..251a60e 100644 --- a/listen.c +++ b/listen.c @@ -56,7 +56,7 @@ void uh_unblock_listeners(void) { struct listener *l; - if (!n_blocked && conf.max_requests && + if ((!n_blocked && conf.max_requests) || n_clients >= conf.max_requests) return; @@ -64,6 +64,10 @@ void uh_unblock_listeners(void) if (!l->blocked) continue; + l->fd.cb(&l->fd, ULOOP_READ); + if (n_clients >= conf.max_requests) + break; + n_blocked--; l->blocked = false; uloop_fd_add(&l->fd, ULOOP_READ); @@ -74,7 +78,10 @@ static void listener_cb(struct uloop_fd *fd, unsigned int events) { struct listener *l = container_of(fd, struct listener, fd); - uh_accept_client(fd->fd); + while (1) { + if (!uh_accept_client(fd->fd, l->tls)) + break; + } if (conf.max_requests && n_clients >= conf.max_requests) uh_block_listener(l);