Fix: Propagate socket timeouts on lttcomm_accept_inet_sock()
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 23 Sep 2014 21:46:32 +0000 (17:46 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Thu, 25 Sep 2014 15:14:04 +0000 (11:14 -0400)
Ensure that send/recv timeouts are applied to new sockets created
from a lttcomm_accept_inet_sock().

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/common/sessiond-comm/inet.c

index 2c959c5fe81ee08d21cca8f0ac42a62d0dfecb6c..cf06ecb858d2079455c7a009f888435b6532d6c4 100644 (file)
@@ -275,6 +275,7 @@ struct lttcomm_sock *lttcomm_accept_inet_sock(struct lttcomm_sock *sock)
        int new_fd;
        socklen_t len;
        struct lttcomm_sock *new_sock;
+       unsigned long timeout;
 
        if (sock->proto == LTTCOMM_SOCK_UDP) {
                /*
@@ -298,6 +299,19 @@ struct lttcomm_sock *lttcomm_accept_inet_sock(struct lttcomm_sock *sock)
                PERROR("accept inet");
                goto error;
        }
+       timeout = lttcomm_get_network_timeout();
+       if (timeout) {
+               int ret;
+
+               ret = lttcomm_setsockopt_rcv_timeout(new_fd, timeout);
+               if (ret) {
+                       goto error;
+               }
+               ret = lttcomm_setsockopt_snd_timeout(new_fd, timeout);
+               if (ret) {
+                       goto error;
+               }
+       }
 
        new_sock->fd = new_fd;
        new_sock->ops = &inet_ops;
This page took 0.026762 seconds and 4 git commands to generate.