inet/inet6 sockets: apply timeout
[lttng-tools.git] / src / common / sessiond-comm / inet.c
index 6d729238a575e8ae149d85a8f25693f7a2554400..eb0c4fde3f6972de1d846020f10aa58a0deaad35 100644 (file)
@@ -57,6 +57,7 @@ LTTNG_HIDDEN
 int lttcomm_create_inet_sock(struct lttcomm_sock *sock, int type, int proto)
 {
        int val = 1, ret;
+       unsigned long timeout;
 
        /* Create server socket */
        if ((sock->fd = socket(PF_INET, type, proto)) < 0) {
@@ -74,6 +75,17 @@ int lttcomm_create_inet_sock(struct lttcomm_sock *sock, int type, int proto)
                PERROR("setsockopt inet");
                goto error;
        }
+       timeout = lttcomm_get_network_timeout();
+       if (timeout) {
+               ret = lttcomm_setsockopt_rcv_timeout(sock->fd, timeout);
+               if (ret) {
+                       goto error;
+               }
+               ret = lttcomm_setsockopt_snd_timeout(sock->fd, timeout);
+               if (ret) {
+                       goto error;
+               }
+       }
 
        return 0;
 
This page took 0.031567 seconds and 4 git commands to generate.