+ for(node = connection_tree->head; node; node = next) {
+ next = node->next;
+ c = node->data;
+
+ c->outgoing = NULL;
+
+ if(c->status.connecting) {
+ terminate_connection(c, false);
+ connection_del(c);
+ }
+ }
+
+ /* Wipe list of outgoing connections */
+
+ for(list_node_t *node = outgoing_list->head; node; node = node->next) {
+ outgoing_t *outgoing = node->data;
+
+ if(outgoing->event)
+ event_del(outgoing->event);
+ }
+
+ list_delete_list(outgoing_list);
+
+ /* Close connections to hosts that have a changed or deleted host config file */
+
+ for(node = connection_tree->head; node; node = node->next) {
+ c = node->data;
+
+ xasprintf(&fname, "%s/hosts/%s", confbase, c->name);
+ if(stat(fname, &s) || s.st_mtime > last_config_check)
+ terminate_connection(c, c->status.active);
+ free(fname);
+ }
+
+ last_config_check = now;
+
+ /* If StrictSubnet is set, expire deleted Subnets and read new ones in */
+
+ if(strictsubnets) {
+ subnet_t *subnet;
+
+ for(node = subnet_tree->head; node; node = node->next) {
+ subnet = node->data;
+ subnet->expires = 1;
+ }
+
+ load_all_subnets();
+
+ for(node = subnet_tree->head; node; node = next) {
+ next = node->next;
+ subnet = node->data;
+ if(subnet->expires == 1) {
+ send_del_subnet(everyone, subnet);
+ if(subnet->owner->status.reachable)
+ subnet_update(subnet->owner, subnet, false);
+ subnet_del(subnet->owner, subnet);
+ } else if(subnet->expires == -1) {
+ subnet->expires = 0;
+ } else {
+ send_add_subnet(everyone, subnet);
+ if(subnet->owner->status.reachable)
+ subnet_update(subnet->owner, subnet, true);
+ }
+ }
+ }
+
+ /* Try to make outgoing connections */
+
+ try_outgoing_connections();
+ }
+
+ /* Dump graph if wanted every 60 seconds*/
+
+ if(last_graph_dump + 60 <= now) {
+ dump_graph();
+ last_graph_dump = now;