sessiond: notification: synchronize notification client (and list)
[lttng-tools.git] / src / bin / lttng-relayd / tcp_keep_alive.c
index 469bec31d19c5f8b8ceada265bdc6b1b1c0315f9..81d0850245377ffdb90c762faefcdb572b0ee67b 100644 (file)
@@ -1,18 +1,8 @@
 /*
- * Copyright (C) 2017 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
+ * Copyright (C) 2017 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2 only,
- * as published by the Free Software Foundation.
+ * SPDX-License-Identifier: GPL-2.0-only
  *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <sys/types.h>
@@ -523,10 +513,10 @@ error:
 
 /* Initialize the TCP keep-alive configuration. */
 __attribute__((constructor)) static
-int tcp_keep_alive_init(void)
+void tcp_keep_alive_init(void)
 {
        tcp_keep_alive_init_support(&support);
-       return tcp_keep_alive_init_config(&support, &config);
+       (void) tcp_keep_alive_init_config(&support, &config);
 }
 
 /*
@@ -544,6 +534,7 @@ int socket_apply_keep_alive_config(int socket_fd)
                goto end;
        }
 
+       DBG("TCP keep-alive enabled for socket %d", socket_fd);
        ret = setsockopt(socket_fd, SOL_SOCKET, SO_KEEPALIVE, &val,
                        sizeof(val));
        if (ret < 0) {
@@ -553,6 +544,7 @@ int socket_apply_keep_alive_config(int socket_fd)
 
        /* TCP keep-alive idle time */
        if (support.idle_time_supported && config.idle_time > 0) {
+               DBG("TCP keep-alive keep idle: %d enabled for socket %d", config.idle_time, socket_fd);
                ret = setsockopt(socket_fd, COMPAT_TCP_LEVEL, COMPAT_TCP_KEEPIDLE, &config.idle_time,
                                sizeof(config.idle_time));
                if (ret < 0) {
@@ -562,6 +554,7 @@ int socket_apply_keep_alive_config(int socket_fd)
        }
        /* TCP keep-alive probe interval */
        if (support.probe_interval_supported && config.probe_interval > 0) {
+               DBG("TCP keep-alive probe_interval: %d enabled for socket %d", config.probe_interval, socket_fd);
                ret = setsockopt(socket_fd, COMPAT_TCP_LEVEL, COMPAT_TCP_KEEPINTVL, &config.probe_interval,
                                sizeof(config.probe_interval));
                if (ret < 0) {
@@ -572,6 +565,7 @@ int socket_apply_keep_alive_config(int socket_fd)
 
        /* TCP keep-alive max probe count */
        if (support.max_probe_count_supported && config.max_probe_count > 0) {
+               DBG("TCP keep-alive max_probe: %d enabled for socket %d", config.max_probe_count, socket_fd);
                ret = setsockopt(socket_fd, COMPAT_TCP_LEVEL, COMPAT_TCP_KEEPCNT, &config.max_probe_count,
                                sizeof(config.max_probe_count));
                if (ret < 0) {
@@ -582,6 +576,7 @@ int socket_apply_keep_alive_config(int socket_fd)
 
        /* TCP keep-alive abort threshold */
        if (support.abort_threshold_supported && config.abort_threshold > 0) {
+               DBG("TCP keep-alive abort threshold: %d enabled for socket %d", config.abort_threshold, socket_fd);
                ret = setsockopt(socket_fd, COMPAT_TCP_LEVEL, COMPAT_TCP_ABORT_THRESHOLD, &config.abort_threshold,
                                sizeof(config.max_probe_count));
                if (ret < 0) {
This page took 0.026304 seconds and 5 git commands to generate.