X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fconnection.c;h=1732b150fcfd499e57f810502266be83f5f10b90;hb=eb049936ffce049cf6b53de8ca0f39c98a360363;hp=d25159e6438c2102b4d7747377ed0e3eba7dac01;hpb=fb7b6e7a0c966a88a682f656ca1caeb9a0583c5b;p=meshlink diff --git a/src/connection.c b/src/connection.c index d25159e6..1732b150 100644 --- a/src/connection.c +++ b/src/connection.c @@ -25,22 +25,20 @@ #include "connection.h" #include "list.h" #include "logger.h" +#include "meshlink_internal.h" #include "utils.h" #include "xalloc.h" -list_t *connection_list; -connection_t *everyone; - void init_connections(void) { - connection_list = list_alloc((list_action_t) free_connection); - everyone = new_connection(); - everyone->name = xstrdup("everyone"); - everyone->hostname = xstrdup("BROADCAST"); + mesh->connections = list_alloc((list_action_t) free_connection); + mesh->everyone = new_connection(); + mesh->everyone->name = xstrdup("mesh->everyone"); + mesh->everyone->hostname = xstrdup("BROADCAST"); } void exit_connections(void) { - list_delete_list(connection_list); - free_connection(everyone); + list_delete_list(mesh->connections); + free_connection(mesh->everyone); } connection_t *new_connection(void) { @@ -72,9 +70,9 @@ void free_connection(connection_t *c) { } void connection_add(connection_t *c) { - list_insert_tail(connection_list, c); + list_insert_tail(mesh->connections, c); } void connection_del(connection_t *c) { - list_delete(connection_list, c); + list_delete(mesh->connections, c); }