[master] 45d4464d0 Remove a wrong vintage 2010 optimization (5f7d80c5034c3ce)

Poul-Henning Kamp phk at FreeBSD.org
Tue Jan 15 21:54:08 UTC 2019


commit 45d4464d0f12123cef34719979730ad21debbe01
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Jan 15 21:47:17 2019 +0000

    Remove a wrong vintage 2010 optimization (5f7d80c5034c3ce)
    
    Solaris, (remember Solaris?) will return connection related errnos
    on fd metadata operations such as ioctl(2), [gs]etsockopt(2) etc.
    
    We propagated these errors up from VTC_(non)blocking() which could,
    theoretically, bail out earlier than it would otherwise have done.
    This complicated code far more than it speeded anything up.
    
    Instead just ensure that any errors returned are indeed connection
    related, and then ignore them, and let Solaris deal with the broken
    connection same way as other operating systems.

diff --git a/lib/libvarnish/vtcp.c b/lib/libvarnish/vtcp.c
index 972595ea0..6ee32f809 100644
--- a/lib/libvarnish/vtcp.c
+++ b/lib/libvarnish/vtcp.c
@@ -213,9 +213,11 @@ VTCP_fastopen(int sock, int depth)
  * us to do two syscalls, one to get and one to set, the latter of
  * which mucks about a bit before it ends up calling ioctl(FIONBIO),
  * at least on FreeBSD.
+ * On Solaris ioctl(FIONBIO) can fail with connection related errnos,
+ * but as long as that is how they fail, we're fine.
  */
 
-int
+void
 VTCP_blocking(int sock)
 {
 	int i, j;
@@ -223,10 +225,9 @@ VTCP_blocking(int sock)
 	i = 0;
 	j = ioctl(sock, FIONBIO, &i);
 	VTCP_Assert(j);
-	return (j);
 }
 
-int
+void
 VTCP_nonblocking(int sock)
 {
 	int i, j;
@@ -234,7 +235,6 @@ VTCP_nonblocking(int sock)
 	i = 1;
 	j = ioctl(sock, FIONBIO, &i);
 	VTCP_Assert(j);
-	return (j);
 }
 
 /*--------------------------------------------------------------------


More information about the varnish-commit mailing list