[master] 074ad32 Uninline VTCP_Check()

Poul-Henning Kamp phk at FreeBSD.org
Sat Mar 7 14:32:39 CET 2015


commit 074ad32b563f2713e443ff54a02f8afe618665ae
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Sat Mar 7 09:02:47 2015 +0000

    Uninline VTCP_Check()

diff --git a/include/vtcp.h b/include/vtcp.h
index f4a9690..b49f3ae 100644
--- a/include/vtcp.h
+++ b/include/vtcp.h
@@ -35,25 +35,7 @@ struct suckaddr;
 #define VTCP_ADDRBUFSIZE		64
 #define VTCP_PORTBUFSIZE		16
 
-static inline int
-VTCP_Check(int a)
-{
-	if (a == 0)
-		return (1);
-	if (errno == ECONNRESET || errno == ENOTCONN)
-		return (1);
-#if (defined (__SVR4) && defined (__sun)) || defined (__NetBSD__)
-	/*
-	 * Solaris returns EINVAL if the other end unexepectedly reset the
-	 * connection.
-	 * This is a bug in Solaris and documented behaviour on NetBSD.
-	 */
-	if (errno == EINVAL || errno == ETIMEDOUT)
-		return (1);
-#endif
-	return (0);
-}
-
+int VTCP_Check(int a);
 #define VTCP_Assert(a) assert(VTCP_Check(a))
 
 void VTCP_myname(int sock, char *abuf, unsigned alen,
diff --git a/lib/libvarnish/vtcp.c b/lib/libvarnish/vtcp.c
index 1295cc9..bdee1c7 100644
--- a/lib/libvarnish/vtcp.c
+++ b/lib/libvarnish/vtcp.c
@@ -344,3 +344,26 @@ VTCP_check_hup(int sock)
 		return (1);
 	return (0);
 }
+
+/*--------------------------------------------------------------------
+ * Check if a TCP syscall return value is fatal
+ */
+
+int
+VTCP_Check(int a)
+{
+	if (a == 0)
+		return (1);
+	if (errno == ECONNRESET || errno == ENOTCONN)
+		return (1);
+#if (defined (__SVR4) && defined (__sun)) || defined (__NetBSD__)
+	/*
+	 * Solaris returns EINVAL if the other end unexepectedly reset the
+	 * connection.
+	 * This is a bug in Solaris and documented behaviour on NetBSD.
+	 */
+	if (errno == EINVAL || errno == ETIMEDOUT)
+		return (1);
+#endif
+	return (0);
+}



More information about the varnish-commit mailing list