Commit 7b8e01ef authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Rewrite the TCP_KEEPALIVE prober to use VTCP_listen_on()

parent dc80d950
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment