[lttng-dev] [RFC PATCH lttng-tools] Fix: Propagate socket timeouts on lttcomm_accept_inet_sock()

David Goulet dgoulet at efficios.com
Thu Sep 25 11:34:08 EDT 2014


Merged!

On 23 Sep (17:46:32), Jérémie Galarneau wrote:
> 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 at efficios.com>
> ---
>  src/common/sessiond-comm/inet.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/src/common/sessiond-comm/inet.c b/src/common/sessiond-comm/inet.c
> index 2c959c5..cf06ecb 100644
> --- a/src/common/sessiond-comm/inet.c
> +++ b/src/common/sessiond-comm/inet.c
> @@ -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;
> -- 
> 2.1.0
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 603 bytes
Desc: Digital signature
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20140925/926a340e/attachment-0001.sig>


More information about the lttng-dev mailing list