From: David Goulet Date: Tue, 27 Aug 2013 19:23:18 +0000 (-0400) Subject: Fix: set the health delta tcp timeout aware X-Git-Tag: v2.2.4~9 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=845e9e6b0740d67510cc299b7231321e5277ee0a;p=lttng-tools.git Fix: set the health delta tcp timeout aware The health check subsystem now initialized the time delta using the TCP timeout. It takes the maximum value between our default internal delta and the TCP timeout fetched by the lttcomm inet subsytem. Signed-off-by: David Goulet --- diff --git a/src/bin/lttng-sessiond/health.c b/src/bin/lttng-sessiond/health.c index dcf3b96e2..fafc9095d 100644 --- a/src/bin/lttng-sessiond/health.c +++ b/src/bin/lttng-sessiond/health.c @@ -24,10 +24,12 @@ #include #include +#include +#include #include "health.h" -static const struct timespec time_delta = { +static struct timespec time_delta = { .tv_sec = DEFAULT_HEALTH_CHECK_DELTA_S, .tv_nsec = DEFAULT_HEALTH_CHECK_DELTA_NS, }; @@ -253,3 +255,19 @@ void health_unregister(void) cds_list_del(&URCU_TLS(health_state).node); state_unlock(); } + +/* + * Initiliazie health check subsytem. This should be called before any health + * register occurs. + */ +void health_init(void) +{ + /* + * Get the maximum value between the default delta value and the TCP + * timeout with a safety net of the default health check delta. + */ + time_delta.tv_sec = max_t(unsigned long, + lttcomm_inet_tcp_timeout + DEFAULT_HEALTH_CHECK_DELTA_S, + time_delta.tv_sec); + DBG("Health check time delta in seconds set to %lu", time_delta.tv_sec); +} diff --git a/src/bin/lttng-sessiond/health.h b/src/bin/lttng-sessiond/health.h index d04d18b78..ebbc0cb0f 100644 --- a/src/bin/lttng-sessiond/health.h +++ b/src/bin/lttng-sessiond/health.h @@ -124,5 +124,6 @@ static inline void health_error(void) int health_check_state(enum health_type type); void health_register(enum health_type type); void health_unregister(void); +void health_init(void); #endif /* _HEALTH_H */ diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 7032191bd..6b1035c34 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -4521,6 +4521,12 @@ int main(int argc, char **argv) /* This is to get the TCP timeout value. */ lttcomm_inet_init(); + /* + * Initialize the health check subsystem. This call should set the + * appropriate time values. + */ + health_init(); + /* Create thread to manage the client socket */ ret = pthread_create(&ht_cleanup_thread, NULL, thread_ht_cleanup, (void *) NULL);