[master] 7b8e01e Rewrite the TCP_KEEPALIVE prober to use VTCP_listen_on()

Poul-Henning Kamp phk at FreeBSD.org
Thu Mar 12 01:36:50 CET 2015


commit 7b8e01efca86c33eb294e460a5482a8cbcb945ac
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Mar 12 00:29:29 2015 +0000

    Rewrite the TCP_KEEPALIVE prober to use VTCP_listen_on()

diff --git a/bin/varnishd/mgt/mgt_param_tcp.c b/bin/varnishd/mgt/mgt_param_tcp.c
index 9212989..fa9dabf 100644
--- a/bin/varnishd/mgt/mgt_param_tcp.c
+++ b/bin/varnishd/mgt/mgt_param_tcp.c
@@ -46,7 +46,6 @@
 #include "mgt/mgt.h"
 #include "common/params.h"
 
-#include "vss.h"
 #include "vtcp.h"
 
 #include "mgt/mgt_param.h"
@@ -94,31 +93,20 @@ tcp_probe(int sock, int nam, const char *param, unsigned def)
 	MCF_SetDefault(param, p);
 }
 
-static int __match_proto__(vss_resolve_f)
-tkp_callback(void *priv, const struct suckaddr *sa)
-{
-	int s;
-
-	(void)priv;
-	s = VTCP_listen(sa, 10, NULL);
-	if (s >= 0) {
-		tcp_probe(s, TCP_KEEPIDLE, "tcp_keepalive_time",	600);
-		tcp_probe(s, TCP_KEEPCNT, "tcp_keepalive_probes",	5);
-		tcp_probe(s, TCP_KEEPINTVL, "tcp_keepalive_intvl",	5);
-		AZ(close(s));
-		return (1);
-	}
-	return (0);
-}
-
 static void
 tcp_keep_probes(void)
 {
 	const char *err;
-	/* Probe a dummy socket for default values */
-	(void)VSS_resolver(":0", NULL, tkp_callback, NULL, &err);
+	int s;
+
+	s = VTCP_listen_on(":0", NULL, 10, &err);
 	if (err != NULL)
 		ARGV_ERR("Could not probe TCP keepalives: %s", err);
+	assert(s > 0);
+	tcp_probe(s, TCP_KEEPIDLE, "tcp_keepalive_time",	600);
+	tcp_probe(s, TCP_KEEPCNT, "tcp_keepalive_probes",	5);
+	tcp_probe(s, TCP_KEEPINTVL, "tcp_keepalive_intvl",	5);
+	AZ(close(s));
 }
 #endif
 



More information about the varnish-commit mailing list