Skip to contentSkip to conversation

Fix: Propagate socket timeouts on lttcomm_accept_inet_sock()

RFC PATCH David Goulet 1 participant 1 message Sep 25, 2014 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Merged!

Quoted 43 lines · Jérémie Galarneau

Ensure that send/recv timeouts are applied to new sockets created from a lttcomm_accept_inet_sock().

---
 src/common/sessiond-comm/inet.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
src/common/sessiond-comm/inet.c +14 -0
index 2c959c5..cf06ecb 100644
@@ -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;
Signature · 1 line
2.1.0

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev