Fix: set app socket timeout just after accept()
authorDavid Goulet <dgoulet@efficios.com>
Fri, 11 Oct 2013 18:59:45 +0000 (14:59 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Fri, 11 Oct 2013 19:03:18 +0000 (15:03 -0400)
This is to make sure the socket has a timeout *before* doing any I/O
operations on it.

Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-sessiond/main.c

index b665deaac1dfe851e4fd82a19c59177a72945e64..ff5749a119167c8cb74333da7583c8e48dfc51ca 100644 (file)
@@ -1308,18 +1308,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();
@@ -1822,6 +1810,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.
This page took 0.031884 seconds and 4 git commands to generate.