Commit e9a93108 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Disable SO_LINGER when we time out a connection due to sess_timeout,

so that we do not RST connections that have still not transmitted their
data.

Since we were able to get the writev(2) to detach the socket, we should
not end up sleeping in the close(2) either.

We still RST the socket for all error conditions.

Ideally I would still like to RST connections that have no outstanding
data after their sess_timeout, in order to avoid the 2*RTT+misc
timeouts delays associated with loosing a TCP socket for a client
that have gone to meet some other IP#.

In particular with load-balancers, this allows the load balancer to
declare the session dead right away, and reuse it for something more
productive.

Unfortunately, this lacks OS support in all presently released
OS'es: you cannot ask if a socket is done transmitting what you
asked it to.

FreeBSD-8.0 will have experimental support for this (FIONWRITE)
and I will revisit it in that context.




git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4183 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 004a3d94
......@@ -190,6 +190,7 @@ vca_main(void *arg)
if (sp->t_open > deadline)
break;
VTAILQ_REMOVE(&sesshead, sp, list);
TCP_linger(sp->fd, 0);
vca_close_session(sp, "timeout");
SES_Delete(sp);
}
......
......@@ -198,6 +198,7 @@ vca_kqueue_main(void *arg)
if (sp->t_open > deadline)
break;
VTAILQ_REMOVE(&sesshead, sp, list);
TCP_linger(sp->fd, 0);
vca_close_session(sp, "timeout");
SES_Delete(sp);
}
......
......@@ -147,6 +147,7 @@ vca_main(void *arg)
continue;
VTAILQ_REMOVE(&sesshead, sp, list);
vca_unpoll(fd);
TCP_linger(sp->fd, 0);
vca_close_session(sp, "timeout");
SES_Delete(sp);
}
......
......@@ -139,6 +139,7 @@ vca_main(void *arg)
VTAILQ_REMOVE(&sesshead, sp, list);
if(sp->fd != -1)
vca_del(sp->fd);
TCP_linger(sp->fd, 0);
vca_close_session(sp, "timeout");
SES_Delete(sp);
}
......
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