X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fmain.c;h=90f11d648e537fee78cbb88506dc6e026f675909;hp=022bbc6d1dc5b293974166f0a92bd04818ba29e2;hb=ae9e45b342636e7b42eafc15cd105bccfbbbe373;hpb=2d90c6c86651b4c9b3818f230508acfcf4fec66f diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 022bbc6d1..90f11d648 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -228,6 +228,11 @@ struct health_state health_thread_app_manage; struct health_state health_thread_app_reg; struct health_state health_thread_kernel; +/* + * Socket timeout for receiving and sending in seconds. + */ +static int app_socket_timeout; + static void setup_consumerd_path(void) { @@ -1205,6 +1210,12 @@ static void *thread_manage_apps(void *data) goto error; } + /* Set socket timeout for both receiving and ending */ + (void) lttcomm_setsockopt_rcv_timeout(ust_cmd.sock, + app_socket_timeout); + (void) lttcomm_setsockopt_snd_timeout(ust_cmd.sock, + app_socket_timeout); + DBG("Apps with sock %d added to poll set", ust_cmd.sock); } @@ -3790,7 +3801,7 @@ int main(int argc, char **argv) { int ret = 0; void *status; - const char *home_path; + const char *home_path, *env_app_timeout; init_kernel_workarounds(); @@ -4070,6 +4081,14 @@ int main(int argc, char **argv) health_init(&ustconsumer64_data.health); health_poll_update(&ustconsumer64_data.health); + /* Check for the application socket timeout env variable. */ + env_app_timeout = getenv(DEFAULT_APP_SOCKET_TIMEOUT_ENV); + if (env_app_timeout) { + app_socket_timeout = atoi(env_app_timeout); + } else { + app_socket_timeout = DEFAULT_APP_SOCKET_RW_TIMEOUT; + } + /* Create thread to manage the client socket */ ret = pthread_create(&health_thread, NULL, thread_manage_health, (void *) NULL);