Commit 42a33a77 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add a "timeout counter" and cleans the timeout sockets every 60

seconds instead of cleaning it in every new connection received.
We are using it here, and the performance is much better now.

Submmitted by:	Rafael Umann <rafael.umann@terra.com.br>

Closes ticket #235



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@2646 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent e5d00cf7
......@@ -71,6 +71,8 @@ vca_main(void *arg)
{
struct epoll_event ev;
double deadline;
int dotimer = 0;
double last_timeout = 0, tmp_timeout;
struct sess *sp, *sp2;
int i;
......@@ -83,7 +85,7 @@ vca_main(void *arg)
vca_add(vca_pipes[0], vca_pipes);
while (1) {
if (epoll_wait(epfd, &ev, 1, 100) > 0) {
if ((dotimer = epoll_wait(epfd, &ev, 1, 100)) > 0) {
if (ev.data.ptr == vca_pipes) {
i = read(vca_pipes[0], &sp, sizeof sp);
assert(i == sizeof sp);
......@@ -100,6 +102,14 @@ vca_main(void *arg)
}
}
}
tmp_timeout = TIM_mono();
if ((tmp_timeout - last_timeout) > 60) {
last_timeout = tmp_timeout;
} else {
if (dotimer > 0)
continue;
}
/* check for timeouts */
deadline = TIM_real() - params->sess_timeout;
VTAILQ_FOREACH_SAFE(sp, &sesshead, list, sp2) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment