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