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>
int new_fd;
socklen_t len;
struct lttcomm_sock *new_sock;
+ unsigned long timeout;
if (sock->proto == LTTCOMM_SOCK_UDP) {
/*
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;