From: David Goulet Date: Fri, 11 Oct 2013 18:59:45 +0000 (-0400) Subject: Fix: set app socket timeout just after accept() X-Git-Tag: v2.4.0-rc1~96 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=16c5c8fae0aa2d10d76645febb1decfb5a366af0 Fix: set app socket timeout just after accept() This is to make sure the socket has a timeout *before* doing any I/O operations on it. Signed-off-by: David Goulet --- diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index de4736643..eccc33a7b 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -1325,18 +1325,6 @@ static void *thread_manage_apps(void *data) goto error; } - /* - * Set socket timeout for both receiving and ending. - * app_socket_timeout is in seconds, whereas - * lttcomm_setsockopt_rcv_timeout and - * lttcomm_setsockopt_snd_timeout expect msec as - * parameter. - */ - (void) lttcomm_setsockopt_rcv_timeout(sock, - app_socket_timeout * 1000); - (void) lttcomm_setsockopt_snd_timeout(sock, - app_socket_timeout * 1000); - DBG("Apps with sock %d added to poll set", sock); health_code_update(); @@ -1839,6 +1827,18 @@ static void *thread_registration_apps(void *data) goto error; } + /* + * Set socket timeout for both receiving and ending. + * app_socket_timeout is in seconds, whereas + * lttcomm_setsockopt_rcv_timeout and + * lttcomm_setsockopt_snd_timeout expect msec as + * parameter. + */ + (void) lttcomm_setsockopt_rcv_timeout(sock, + app_socket_timeout * 1000); + (void) lttcomm_setsockopt_snd_timeout(sock, + app_socket_timeout * 1000); + /* * Set the CLOEXEC flag. Return code is useless because * either way, the show must go on.