[6.0] 7fb6cbcd3 Remove a wrong vintage 2010 optimization (5f7d80c5034c3ce)

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Wed Jul 10 07:42:09 UTC 2019


commit 7fb6cbcd33623a763a901dac4063512703016815
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 696753b00..759be1f64 100644
--- a/lib/libvarnish/vtcp.c
+++ b/lib/libvarnish/vtcp.c
@@ -214,9 +214,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;
@@ -224,10 +226,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;
@@ -235,7 +236,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