--- varnish-3.0.0/bin/varnishd/cache_acceptor.c 2011-06-16 14:24:54.000000000 +0300 +++ varnish-3.0.0-uto/bin/varnishd/cache_acceptor.c 2011-08-16 20:22:59.000000000 +0300 @@ -35,10 +35,12 @@ #include #include #include #include +#include +#include #include #include #include #include "vcli.h" @@ -245,21 +247,30 @@ SO_SNDTIMEO, &tv_sndtimeo, sizeof tv_sndtimeo)); } } #endif -#ifdef SO_RCVTIMEO_WORKS +#if defined(SO_RCVTIMEO_WORKS) || defined(TCP_SNDUTO_TIMEOUT) if (params->sess_timeout != sess_timeout) { need_test = 1; sess_timeout = params->sess_timeout; tv_rcvtimeo = TIM_timeval(sess_timeout); VTAILQ_FOREACH(ls, &heritage.socks, list) { if (ls->sock < 0) continue; +#ifdef SO_RCVTIMEO_WORKS AZ(setsockopt(ls->sock, SOL_SOCKET, SO_RCVTIMEO, &tv_rcvtimeo, sizeof tv_rcvtimeo)); +#endif +#ifdef TCP_SNDUTO_TIMEOUT + int optval = (int)sess_timeout; + AZ(setsockopt(ls->sock, IPPROTO_TCP, + TCP_SNDUTO_TIMEOUT, + &optval, sizeof optval)); +#endif + } } #endif /* Bound the pacing delay by parameter */ if (pace > params->acceptor_sleep_max)