Fix: set the health delta tcp timeout aware
[lttng-tools.git] / src / bin / lttng-sessiond / health.c
index dcf3b96e2b48c7fc4030005818d2bb92b4dda71a..fafc9095df57e89d88baeede25e4adfa8b634fe9 100644 (file)
 
 #include <common/defaults.h>
 #include <common/error.h>
+#include <common/macros.h>
+#include <common/sessiond-comm/inet.h>
 
 #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);
+}
This page took 0.025449 seconds and 5 git commands to generate.