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

r4046 forgot to reset SO_LINGER for pipe handling which basically

broke pipehandling.

Fixes #505



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4047 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 7243e9c5
......@@ -247,8 +247,7 @@ cnt_done(struct sess *sp)
* This is an orderly close of the connection; ditch linger
* before we close, to get queued data transmitted.
*/
struct linger lin = { 0, 0 };
AZ(setsockopt(sp->fd, SOL_SOCKET, SO_LINGER, &lin, sizeof lin));
TCP_linger(sp->fd, 0);
vca_close_session(sp, sp->doclose);
}
if (sp->fd < 0) {
......
......@@ -98,8 +98,12 @@ PipeSession(struct sess *sp)
sp->t_resp = TIM_real();
memset(fds, 0, sizeof fds);
TCP_linger(vc->fd, 0);
fds[0].fd = vc->fd;
fds[0].events = POLLIN | POLLERR;
TCP_linger(sp->fd, 0);
fds[1].fd = sp->fd;
fds[1].events = POLLIN | POLLERR;
......
......@@ -61,6 +61,7 @@ void TCP_myname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen);
int TCP_filter_http(int sock);
void TCP_blocking(int sock);
void TCP_nonblocking(int sock);
void TCP_linger(int sock, int linger);
#ifdef SOL_SOCKET
void TCP_name(const struct sockaddr *addr, unsigned l, char *abuf,
unsigned alen, char *pbuf, unsigned plen);
......
......@@ -222,3 +222,17 @@ TCP_set_read_timeout(int s, double seconds)
AZ(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof timeout));
#endif
}
/*--------------------------------------------------------------------
* Set or reset SO_LINGER flag
*/
void
TCP_linger(int sock, int linger)
{
struct linger lin;
memset(&lin, 0, sizeof lin);
lin.l_onoff = linger;
AZ(setsockopt(sock, SOL_SOCKET, SO_LINGER, &lin, sizeof lin));
}
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