#include "graph.h"
#include "logger.h"
#include "meta.h"
-#include "names.h"
#include "net.h"
#include "netutl.h"
#include "protocol.h"
static timeout_t pingtimer;
static timeout_t periodictimer;
+//TODO: move this to a better place
+char *confbase;
+
/* Purge edges of unreachable nodes. Use carefully. */
// TODO: remove
*/
static void timeout_handler(void *data) {
for list_each(connection_t, c, connection_list) {
- if(c->status.control)
- continue;
-
if(c->last_ping_time + pingtimeout <= now.tv_sec) {
if(c->status.active) {
if(c->status.pinged) {
/* Count number of active connections */
int nc = 0;
for list_each(connection_t, c, connection_list) {
- if(c->status.active && !c->status.control)
+ if(c->status.active)
nc++;
}
int i = 0;
for list_each(connection_t, c, connection_list) {
- if(!c->status.active || c->status.control)
+ if(!c->status.active)
continue;
if(i++ != r)
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);
}
/* Close connections to hosts that have a changed or deleted host config file */
for list_each(connection_t, c, connection_list) {
- if(c->status.control)
- continue;
-
xasprintf(&fname, "%s" SLASH "hosts" SLASH "%s", confbase, c->name);
struct stat s;
if(stat(fname, &s) || s.st_mtime > last_config_check) {