[3.0] 601d7d3 Work around a Solaris bug.

Tollef Fog Heen tfheen at varnish-cache.org
Wed Oct 26 14:58:54 CEST 2011


commit 601d7d3ff87b917ea1d2ba595a3c98c9a7e18e4e
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Oct 13 09:59:03 2011 +0000

    Work around a Solaris bug.
    
    Submitted by:	Nils Goroll

diff --git a/lib/libvarnish/tcp.c b/lib/libvarnish/tcp.c
index c612e97..f544bdc 100644
--- a/lib/libvarnish/tcp.c
+++ b/lib/libvarnish/tcp.c
@@ -267,7 +267,13 @@ VTCP_set_read_timeout(int s, double seconds)
 	timeout.tv_sec = (int)floor(seconds);
 	timeout.tv_usec = (int)(1e6 * (seconds - timeout.tv_sec));
 #ifdef SO_RCVTIMEO_WORKS
-	AZ(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof timeout));
+	/* 
+	 * Solaris bug (present at least in snv_151 and older): If this fails
+	 * with EINVAL, the socket is half-closed (SS_CANTSENDMORE) and the
+	 * timeout does not get set. Needs to be fixed in Solaris, there is
+	 * nothing we can do about this.
+	 */
+	VTCP_Assert(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof timeout));
 #else
 	(void)s;
 #endif



More information about the varnish-commit mailing list