summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
cb5f6f1)
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 <dgoulet@efficios.com>
#include <common/defaults.h>
#include <common/error.h>
#include <common/defaults.h>
#include <common/error.h>
+#include <common/macros.h>
+#include <common/sessiond-comm/inet.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,
};
.tv_sec = DEFAULT_HEALTH_CHECK_DELTA_S,
.tv_nsec = DEFAULT_HEALTH_CHECK_DELTA_NS,
};
cds_list_del(&URCU_TLS(health_state).node);
state_unlock();
}
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);
+}
int health_check_state(enum health_type type);
void health_register(enum health_type type);
void health_unregister(void);
int health_check_state(enum health_type type);
void health_register(enum health_type type);
void health_unregister(void);
/* This is to get the TCP timeout value. */
lttcomm_inet_init();
/* 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);
/* Create thread to manage the client socket */
ret = pthread_create(&ht_cleanup_thread, NULL,
thread_ht_cleanup, (void *) NULL);