]> git.meshlink.io Git - meshlink/blobdiff - src/net_setup.c
Move several variables to mesh.
[meshlink] / src / net_setup.c
index 62b12b55e062b835d0e66f7d31e9671f02f8cb58..d966f1632b9a406fca8149ac7f48c06ae88cb414 100644 (file)
@@ -94,7 +94,7 @@ static bool read_ecdsa_private_key(void) {
        FILE *fp;
        char *fname;
 
-       xasprintf(&fname, "%s" SLASH "ecdsa_key.priv", confbase);
+       xasprintf(&fname, "%s" SLASH "ecdsa_key.priv", mesh->confbase);
        fp = fopen(fname, "r");
        free(fname);
 
@@ -121,7 +121,7 @@ static bool read_invitation_key(void) {
                invitation_key = NULL;
        }
 
-       xasprintf(&fname, "%s" SLASH "invitations" SLASH "ecdsa_key.priv", confbase);
+       xasprintf(&fname, "%s" SLASH "invitations" SLASH "ecdsa_key.priv", mesh->confbase);
 
        fp = fopen(fname, "r");
 
@@ -153,7 +153,7 @@ void load_all_nodes(void) {
        struct dirent *ent;
        char *dname;
 
-       xasprintf(&dname, "%s" SLASH "hosts", confbase);
+       xasprintf(&dname, "%s" SLASH "hosts", mesh->confbase);
        dir = opendir(dname);
        if(!dir) {
                logger(DEBUG_ALWAYS, LOG_ERR, "Could not open %s: %s", dname, strerror(errno));
@@ -181,7 +181,7 @@ void load_all_nodes(void) {
 char *get_name(void) {
        char *name = NULL;
 
-       get_config_string(lookup_config(config_tree, "Name"), &name);
+       get_config_string(lookup_config(mesh->config, "Name"), &name);
 
        if(!name)
                return NULL;
@@ -303,9 +303,9 @@ bool setup_myself(void) {
        mesh->self->connection = new_connection();
        mesh->self->name = name;
        mesh->self->connection->name = xstrdup(name);
-       read_host_config(config_tree, name);
+       read_host_config(mesh->config, name);
 
-       if(!get_config_string(lookup_config(config_tree, "Port"), &myport))
+       if(!get_config_string(lookup_config(mesh->config, "Port"), &myport))
                myport = xstrdup("655");
        else
                port_specified = true;
@@ -381,7 +381,7 @@ bool setup_myself(void) {
 
        /* Done. */
 
-       last_config_check = now.tv_sec;
+       mesh->last_config_check = now.tv_sec;
 
        return true;
 }
@@ -416,8 +416,8 @@ void close_network_connections(void) {
                terminate_connection(c, false);
        }
 
-       if(outgoing_list)
-               list_delete_list(outgoing_list);
+       if(mesh->outgoings)
+               list_delete_list(mesh->outgoings);
 
        if(mesh->self && mesh->self->connection) {
                terminate_connection(mesh->self->connection, false);