From: Fabian Keil Date: Sun, 21 Oct 2012 12:44:58 +0000 (+0000) Subject: Set the socket option SO_LINGER for the client socket in accept_connection() X-Git-Tag: v_3_0_20~233 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=2ed19f071a3ddae438ced3269cc70b413ace18ae Set the socket option SO_LINGER for the client socket in accept_connection() This should further reduce the chances of the client getting an incomplete response, even though Privoxy wrote the whole one to the socket. --- diff --git a/jbsockets.c b/jbsockets.c index 7df26911..45b57a9e 100644 --- a/jbsockets.c +++ b/jbsockets.c @@ -1,4 +1,4 @@ -const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.116 2012/10/12 11:23:53 fabiankeil Exp $"; +const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.117 2012/10/17 18:01:34 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jbsockets.c,v $ @@ -1267,6 +1267,18 @@ int accept_connection(struct client_state * csp, jb_socket fds[]) } #endif +#ifdef SO_LINGER + { + struct linger linger_options; + linger_options.l_onoff = 1; + linger_options.l_linger = 5; + if (0 != setsockopt(fd, SOL_SOCKET, SO_LINGER, &linger_options, sizeof(linger_options))) + { + log_error(LOG_LEVEL_ERROR, "Setting SO_LINGER on socket %d failed.", afd); + } + } +#endif + csp->cfd = afd; #ifdef HAVE_RFC2553 csp->ip_addr_str = malloc(NI_MAXHOST);