#include "xalloc.h"
avl_tree_t *connection_tree; /* Meta connections */
-connection_t *broadcast;
+connection_t *everyone;
static int connection_compare(const connection_t *a, const connection_t *b) {
return a < b ? -1 : a == b ? 0 : 1;
void init_connections(void) {
connection_tree = avl_alloc_tree((avl_compare_t) connection_compare, (avl_action_t) free_connection);
- broadcast = new_connection();
- broadcast->name = xstrdup("everyone");
- broadcast->hostname = xstrdup("BROADCAST");
+ everyone = new_connection();
+ everyone->name = xstrdup("everyone");
+ everyone->hostname = xstrdup("BROADCAST");
}
void exit_connections(void) {
avl_delete_tree(connection_tree);
- free_connection(broadcast);
+ free_connection(everyone);
}
connection_t *new_connection(void) {
} connection_t;
extern avl_tree_t *connection_tree;
-extern connection_t *broadcast;
+extern connection_t *everyone;
extern void init_connections(void);
extern void exit_connections(void);
for(snode = n->subnet_tree->head; snode; snode = snext) {
snext = snode->next;
s = snode->data;
- send_del_subnet(broadcast, s);
+ send_del_subnet(everyone, s);
if(!strictsubnets)
subnet_del(n, s);
}
enext = enode->next;
e = enode->data;
if(!tunnelserver)
- send_del_edge(broadcast, e);
+ send_del_edge(everyone, e);
edge_del(e);
}
}
if(c->edge) {
if(report && !tunnelserver)
- send_del_edge(broadcast, c->edge);
+ send_del_edge(everyone, c->edge);
edge_del(c->edge);
e = lookup_edge(c->node, myself);
if(e) {
if(!tunnelserver)
- send_del_edge(broadcast, e);
+ send_del_edge(everyone, e);
edge_del(e);
}
}
next = node->next;
subnet = node->data;
if(subnet->expires == 1) {
- send_del_subnet(broadcast, subnet);
+ 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(broadcast, subnet);
+ send_add_subnet(everyone, subnet);
if(subnet->owner->status.reachable)
subnet_update(subnet->owner, subnet, true);
}
buffer[len++] = '\n';
- if(c == broadcast) {
+ if(c == everyone) {
broadcast_meta(NULL, buffer, len);
return true;
} else
if(tunnelserver)
send_add_edge(c, c->edge);
else
- send_add_edge(broadcast, c->edge);
+ send_add_edge(everyone, c->edge);
/* Run MST and SSSP algorithms */
e = lookup_edge(to, myself);
if(e) {
if(!tunnelserver)
- send_del_edge(broadcast, e);
+ send_del_edge(everyone, e);
edge_del(e);
}
}
avl_node_t *node;
connection_t *c;
- send_request(broadcast, "%d %x %s", KEY_CHANGED, rand(), myself->name);
+ send_request(everyone, "%d %x %s", KEY_CHANGED, rand(), myself->name);
/* Immediately send new keys to directly connected nodes to keep UDP mappings alive */