Re-add support for SIGALRM.
This commit is contained in:
parent
386c1aff08
commit
3b237afbda
4 changed files with 36 additions and 20 deletions
|
@ -1632,6 +1632,13 @@ You can also send the following signals to a running tincd process:
|
||||||
@c from the manpage
|
@c from the manpage
|
||||||
@table @samp
|
@table @samp
|
||||||
|
|
||||||
|
@item ALRM
|
||||||
|
Forces tinc to try to connect to all uplinks immediately.
|
||||||
|
Usually tinc attempts to do this itself,
|
||||||
|
but increases the time it waits between the attempts each time it failed,
|
||||||
|
and if tinc didn't succeed to connect to an uplink the first time after it started,
|
||||||
|
it defaults to the maximum time of 15 minutes.
|
||||||
|
|
||||||
@item HUP
|
@item HUP
|
||||||
Partially rereads configuration files.
|
Partially rereads configuration files.
|
||||||
Connections to hosts whose host config file are removed are closed.
|
Connections to hosts whose host config file are removed are closed.
|
||||||
|
|
|
@ -98,6 +98,18 @@ Output version information and exit.
|
||||||
.El
|
.El
|
||||||
.Sh SIGNALS
|
.Sh SIGNALS
|
||||||
.Bl -tag -width indent
|
.Bl -tag -width indent
|
||||||
|
.It ALRM
|
||||||
|
Forces
|
||||||
|
.Nm
|
||||||
|
to try to connect to all uplinks immediately.
|
||||||
|
Usually
|
||||||
|
.Nm
|
||||||
|
attempts to do this itself,
|
||||||
|
but increases the time it waits between the attempts each time it failed,
|
||||||
|
and if
|
||||||
|
.Nm
|
||||||
|
didn't succeed to connect to an uplink the first time after it started,
|
||||||
|
it defaults to the maximum time of 15 minutes.
|
||||||
.It HUP
|
.It HUP
|
||||||
Partially rereads configuration files.
|
Partially rereads configuration files.
|
||||||
Connections to hosts whose host config file are removed are closed.
|
Connections to hosts whose host config file are removed are closed.
|
||||||
|
@ -108,15 +120,6 @@ If the
|
||||||
.Fl -logfile
|
.Fl -logfile
|
||||||
option is used, this will also close and reopen the log file,
|
option is used, this will also close and reopen the log file,
|
||||||
useful when log rotation is used.
|
useful when log rotation is used.
|
||||||
.It INT
|
|
||||||
Temporarily increases debug level to 5.
|
|
||||||
Send this signal again to revert to the original level.
|
|
||||||
.It USR1
|
|
||||||
Dumps the connection list to syslog.
|
|
||||||
.It USR2
|
|
||||||
Dumps virtual network device statistics, all known nodes, edges and subnets to syslog.
|
|
||||||
.It WINCH
|
|
||||||
Purges all information remembered about unreachable nodes.
|
|
||||||
.El
|
.El
|
||||||
.Sh DEBUG LEVELS
|
.Sh DEBUG LEVELS
|
||||||
The tinc daemon can send a lot of messages to the syslog.
|
The tinc daemon can send a lot of messages to the syslog.
|
||||||
|
|
27
src/net.c
27
src/net.c
|
@ -248,6 +248,11 @@ static void sighup_handler(int signal, short events, void *data) {
|
||||||
reload_configuration();
|
reload_configuration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void sigalrm_handler(int signal, short events, void *data) {
|
||||||
|
logger(LOG_NOTICE, "Got %s signal", strsignal(signal));
|
||||||
|
retry();
|
||||||
|
}
|
||||||
|
|
||||||
int reload_configuration(void) {
|
int reload_configuration(void) {
|
||||||
connection_t *c;
|
connection_t *c;
|
||||||
splay_node_t *node, *next;
|
splay_node_t *node, *next;
|
||||||
|
@ -349,24 +354,24 @@ void retry(void) {
|
||||||
*/
|
*/
|
||||||
int main_loop(void) {
|
int main_loop(void) {
|
||||||
struct event timeout_event;
|
struct event timeout_event;
|
||||||
struct event sighup_event;
|
|
||||||
struct event sigterm_event;
|
|
||||||
struct event sigquit_event;
|
|
||||||
|
|
||||||
timeout_set(&timeout_event, timeout_handler, &timeout_event);
|
timeout_set(&timeout_event, timeout_handler, &timeout_event);
|
||||||
event_add(&timeout_event, &(struct timeval){pingtimeout, 0});
|
event_add(&timeout_event, &(struct timeval){pingtimeout, 0});
|
||||||
|
|
||||||
#ifdef SIGHUP
|
#ifndef HAVE_MINGW
|
||||||
|
struct event sighup_event;
|
||||||
|
struct event sigterm_event;
|
||||||
|
struct event sigquit_event;
|
||||||
|
struct event sigalrm_event;
|
||||||
|
|
||||||
signal_set(&sighup_event, SIGHUP, sighup_handler, NULL);
|
signal_set(&sighup_event, SIGHUP, sighup_handler, NULL);
|
||||||
signal_add(&sighup_event, NULL);
|
signal_add(&sighup_event, NULL);
|
||||||
#endif
|
|
||||||
#ifdef SIGTERM
|
|
||||||
signal_set(&sigterm_event, SIGTERM, sigterm_handler, NULL);
|
signal_set(&sigterm_event, SIGTERM, sigterm_handler, NULL);
|
||||||
signal_add(&sigterm_event, NULL);
|
signal_add(&sigterm_event, NULL);
|
||||||
#endif
|
|
||||||
#ifdef SIGQUIT
|
|
||||||
signal_set(&sigquit_event, SIGQUIT, sigterm_handler, NULL);
|
signal_set(&sigquit_event, SIGQUIT, sigterm_handler, NULL);
|
||||||
signal_add(&sigquit_event, NULL);
|
signal_add(&sigquit_event, NULL);
|
||||||
|
signal_set(&sigalrm_event, SIGALRM, sigalrm_handler, NULL);
|
||||||
|
signal_add(&sigalrm_event, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(event_loop(0) < 0) {
|
if(event_loop(0) < 0) {
|
||||||
|
@ -374,12 +379,14 @@ int main_loop(void) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAVE_MINGW
|
||||||
signal_del(&sighup_event);
|
signal_del(&sighup_event);
|
||||||
signal_del(&sigterm_event);
|
signal_del(&sigterm_event);
|
||||||
signal_del(&sigquit_event);
|
signal_del(&sigquit_event);
|
||||||
|
signal_del(&sigalrm_event);
|
||||||
|
#endif
|
||||||
|
|
||||||
if(timeout_initialized(&timeout_event))
|
event_del(&timeout_event);
|
||||||
event_del(&timeout_event);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,7 +224,6 @@ bool init_service(void) {
|
||||||
*/
|
*/
|
||||||
bool detach(void) {
|
bool detach(void) {
|
||||||
#ifndef HAVE_MINGW
|
#ifndef HAVE_MINGW
|
||||||
signal(SIGALRM, SIG_IGN);
|
|
||||||
signal(SIGPIPE, SIG_IGN);
|
signal(SIGPIPE, SIG_IGN);
|
||||||
signal(SIGUSR1, SIG_IGN);
|
signal(SIGUSR1, SIG_IGN);
|
||||||
signal(SIGUSR2, SIG_IGN);
|
signal(SIGUSR2, SIG_IGN);
|
||||||
|
|
Loading…
Reference in a new issue