Project

General

Profile

Bug #546 » socket-timeout-1.patch

socket-timeout-1.patch - Mathieu Desnoyers, 07/11/2013 01:49 PM

View differences:

doc/man/lttng-relayd.8
.TP
.BR "-V, --version"
Show version number
.SH "ENVIRONMENT VARIABLES"
.PP
.IP "LTTNG_NETWORK_SOCKET_TIMEOUT"
Control timeout of socket connection, receive and send. Takes an integer
parameter: the timeout value, in milliseconds. A value of 0 or -1 uses
the timeout of the operating system (this is the default).
.PP
.SH "SEE ALSO"
.PP
doc/man/lttng-sessiond.8
debuggers to work with sessiond on some operating systems.
.IP "LTTNG_APP_SOCKET_TIMEOUT"
Control the timeout of application's socket when sending and receiving
commands. After this period of time, the application is unregistered by the
session daemon. A value of 0 or -1 means an infinite timeout. Default value is
5 seconds.
commands. Takes an integer parameter: the timeout value, in seconds.
After this period of time, the application is unregistered by the
session daemon. A value of 0 or -1 means an infinite timeout. Default
value is 5 seconds.
.IP "LTTNG_NETWORK_SOCKET_TIMEOUT"
Control timeout of socket connection, receive and send. Takes an integer
parameter: the timeout value, in milliseconds. A value of 0 or -1 uses
the timeout of the operating system (this is the default).
.SH "SEE ALSO"
.PP
src/bin/lttng-consumerd/lttng-consumerd.c
}
ctx->type = opt_type;
/* Initialize communication library */
lttcomm_init();
/* Create thread to manage channels */
ret = pthread_create(&channel_thread, NULL, consumer_thread_channel_poll,
(void *) ctx);
src/bin/lttng-relayd/main.c
/* Set up max poll set size */
lttng_poll_set_max_size();
/* Initialize communication library */
lttcomm_init();
/* Setup the dispatcher thread */
ret = pthread_create(&dispatcher_thread, NULL,
relay_thread_dispatcher, (void *) NULL);
src/bin/lttng-sessiond/main.c
write_pidfile();
/* Initialize communication library */
lttcomm_init();
/* Create thread to manage the client socket */
ret = pthread_create(&ht_cleanup_thread, NULL,
thread_ht_cleanup, (void *) NULL);
src/common/sessiond-comm/sessiond-comm.c
/* For Inet6 socket */
#include "inet6.h"
#define NETWORK_TIMEOUT_ENV "LTTNG_NETWORK_SOCKET_TIMEOUT"
static struct lttcomm_net_family net_families[] = {
{ LTTCOMM_INET, lttcomm_create_inet_sock },
{ LTTCOMM_INET6, lttcomm_create_inet6_sock },
......
[ LTTCOMM_ERR_INDEX(LTTCOMM_NR) ] = "Unknown error code"
};
static unsigned long network_timeout;
/*
* Return ptr to string representing a human readable error code from the
* lttcomm_return_code enum.
......
error:
return NULL;
}
LTTNG_HIDDEN
void lttcomm_init(void)
{
const char *env;
env = getenv(NETWORK_TIMEOUT_ENV);
if (env) {
long timeout;
errno = 0;
timeout = strtol(env, NULL, 0);
if (errno != 0 || timeout < -1L) {
PERROR("Network timeout");
} else {
if (timeout > 0) {
network_timeout = timeout;
}
}
}
}
LTTNG_HIDDEN
unsigned long lttcomm_get_network_timeout(void)
{
return network_timeout;
}
src/common/sessiond-comm/sessiond-comm.h
extern struct lttcomm_relayd_sock *lttcomm_alloc_relayd_sock(
struct lttng_uri *uri, uint32_t major, uint32_t minor);
extern void lttcomm_init(void);
/* Get network timeout, in milliseconds */
extern unsigned long lttcomm_get_network_timeout(void);
#endif /* _LTTNG_SESSIOND_COMM_H */
(13-13/19)