#include "stream.h"
#include "connection.h"
#include "tracefile-array.h"
+#include "tcp_keep_alive.h"
static const char *help_msg =
#ifdef LTTNG_EMBED_HELP
lttcomm_destroy_sock(newsock);
goto error;
}
+
+ ret = socket_apply_keep_alive_config(newsock->fd);
+ if (ret < 0) {
+ ERR("Failed to apply TCP keep-alive configuration on socket (%i)",
+ newsock->fd);
+ lttcomm_destroy_sock(newsock);
+ goto error;
+ }
+
new_conn = connection_create(newsock, type);
if (!new_conn) {
lttcomm_destroy_sock(newsock);
health_code_update();
- while (!CMM_LOAD_SHARED(dispatch_thread_exit)) {
+ for (;;) {
health_code_update();
/* Atomically prepare the queue futex */
futex_nto1_prepare(&relay_conn_queue.futex);
+ if (CMM_LOAD_SHARED(dispatch_thread_exit)) {
+ break;
+ }
+
do {
health_code_update();
{
int ret;
struct lttcomm_relayd_version reply, msg;
+ bool compatible = true;
conn->version_check_done = 1;
if (reply.major != be32toh(msg.major)) {
DBG("Incompatible major versions (%u vs %u), deleting session",
reply.major, be32toh(msg.major));
- connection_put(conn);
- ret = 0;
- goto end;
+ compatible = false;
}
conn->major = reply.major;
ERR("Relay sending version");
}
+ if (!compatible) {
+ ret = -1;
+ goto end;
+ }
+
DBG("Version check done using protocol %u.%u", conn->major,
conn->minor);