-#ifndef HAVE_MINGW
-static void sigterm_handler(void *data) {
- logger(DEBUG_ALWAYS, LOG_NOTICE, "Got %s signal", strsignal(((signal_t *)data)->signum));
- event_exit();
-}
-
-static void sighup_handler(void *data) {
- logger(DEBUG_ALWAYS, LOG_NOTICE, "Got %s signal", strsignal(((signal_t *)data)->signum));
- reopenlogger();
- if(reload_configuration())
- exit(1);
-}
-
-static void sigalrm_handler(void *data) {
- logger(DEBUG_ALWAYS, LOG_NOTICE, "Got %s signal", strsignal(((signal_t *)data)->signum));
- retry();
-}
-#endif
-
-int reload_configuration(void) {
- char *fname = NULL;
-
- /* Reread our own configuration file */
-
- exit_configuration(&config_tree);
- init_configuration(&config_tree);
-
- if(!read_server_config()) {
- logger(DEBUG_ALWAYS, LOG_ERR, "Unable to reread configuration file.");
- return EINVAL;
- }
-
- read_config_options(config_tree, NULL);
-
- xasprintf(&fname, "%s" SLASH "hosts" SLASH "%s", confbase, myself->name);
- read_config_file(config_tree, fname);
- free(fname);
-
- /* Parse some options that are allowed to be changed while tinc is running */
-
- setup_myself_reloadable();
-
- /* Try to make outgoing connections */
-
- try_outgoing_connections();
-
- /* Close connections to hosts that have a changed or deleted host config file */
-
- for list_each(connection_t, c, connection_list) {
- xasprintf(&fname, "%s" SLASH "hosts" SLASH "%s", confbase, c->name);
- struct stat s;
- if(stat(fname, &s) || s.st_mtime > last_config_check) {
- logger(DEBUG_CONNECTIONS, LOG_INFO, "Host config file of %s has been changed", c->name);
- terminate_connection(c, c->status.active);
- }
- free(fname);
- }
-
- last_config_check = now.tv_sec;
-
- return 0;
-}
-
-void retry(void) {