[master] e600a75 Work around a Solaris bug.

Poul-Henning Kamp phk at varnish-cache.org
Thu Oct 13 11:59:27 CEST 2011


commit e600a75ed5d35db87b36bf64d45940e50c0d25c7
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/vtcp.c b/lib/libvarnish/vtcp.c
index 10c3664..c0f7a95 100644
--- a/lib/libvarnish/vtcp.c
+++ b/lib/libvarnish/vtcp.c
@@ -265,7 +265,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