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)
{
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);
}
ret = lttcomm_listen_unix_sock(client_sock);
if (ret < 0) {
- goto error;
+ goto error_listen;
}
/*
*/
ret = create_thread_poll_set(&events, 2);
if (ret < 0) {
- goto error;
+ goto error_create_poll;
}
/* Add the application registration socket */
exit:
error:
- if (err) {
- health_error(&health_thread_cmd);
- ERR("Health error occurred in %s", __func__);
+ if (sock >= 0) {
+ ret = close(sock);
+ if (ret) {
+ PERROR("close");
+ }
}
- health_exit(&health_thread_cmd);
- DBG("Client thread dying");
+ lttng_poll_clean(&events);
+ clean_command_ctx(&cmd_ctx);
+
+error_listen:
+error_create_poll:
unlink(client_unix_sock_path);
if (client_sock >= 0) {
ret = close(client_sock);
PERROR("close");
}
}
- if (sock >= 0) {
- ret = close(sock);
- if (ret) {
- PERROR("close");
- }
+
+ if (err) {
+ health_error(&health_thread_cmd);
+ ERR("Health error occurred in %s", __func__);
}
- lttng_poll_clean(&events);
- clean_command_ctx(&cmd_ctx);
+ health_exit(&health_thread_cmd);
+
+ DBG("Client thread dying");
rcu_unregister_thread();
return NULL;
{
int ret = 0;
void *status;
- const char *home_path;
+ const char *home_path, *env_app_timeout;
init_kernel_workarounds();
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);