#include "netutl.h"
#include "packmsg.h"
#include "protocol.h"
-#include "route.h"
#include "utils.h"
#include "xalloc.h"
-#include "submesh.h"
/// Helper function to start parsing a host config file
static bool node_get_config(meshlink_handle_t *mesh, node_t *n, config_t *config, packmsg_input_t *in) {
/// Fill in node details from a config blob.
bool node_read_from_config(meshlink_handle_t *mesh, node_t *n, const config_t *config) {
+ (void)mesh;
+
if(n->canonical_address) {
return true;
}
n->name = name;
}
- char *submesh_name = packmsg_get_str_dup(&in);
-
- if(!strcmp(submesh_name, CORE_MESH)) {
- free(submesh_name);
- n->submesh = NULL;
- } else {
- n->submesh = lookup_or_create_submesh(mesh, submesh_name);
- free(submesh_name);
-
- if(!n->submesh) {
- return false;
- }
- }
+ packmsg_skip_element(&in); // submesh_name
n->devclass = packmsg_get_int32(&in);
n->status.blacklisted = packmsg_get_bool(&in);
packmsg_add_uint32(&out, MESHLINK_CONFIG_VERSION);
packmsg_add_str(&out, n->name);
- packmsg_add_str(&out, n->submesh ? n->submesh->name : CORE_MESH);
+ packmsg_add_str(&out, CORE_MESH);
packmsg_add_int32(&out, n->devclass);
packmsg_add_bool(&out, n->status.blacklisted);
*/
bool setup_network(meshlink_handle_t *mesh) {
init_connections(mesh);
- init_submeshes(mesh);
init_nodes(mesh);
- init_requests(mesh);
if(!setup_myself(mesh)) {
return false;
close all open network connections
*/
void close_network_connections(meshlink_handle_t *mesh) {
- if(mesh->connections) {
- for(list_node_t *node = mesh->connections->head, *next; node; node = next) {
- next = node->next;
- connection_t *c = node->data;
- c->outgoing = NULL;
- terminate_connection(mesh, c, false);
- }
+ if(mesh->connection) {
+ mesh->connection->outgoing = NULL;
+ terminate_connection(mesh, mesh->connection, false);
}
- exit_requests(mesh);
exit_nodes(mesh);
- exit_submeshes(mesh);
exit_connections(mesh);
free(mesh->myport);
mesh->myport = NULL;
-
mesh->self = NULL;
-
- return;
}