X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fhealth.c;h=fafc9095df57e89d88baeede25e4adfa8b634fe9;hp=dcf3b96e2b48c7fc4030005818d2bb92b4dda71a;hb=67e056446003680180ed4f384217facd90b1a776;hpb=d831c2497e9e8b2360cbe2026fdb2d736fa07641 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); +}