meshlink_handle_t *mesh = xzalloc(sizeof *mesh);
mesh->confbase = xstrdup(confbase);
if (usingname) mesh->name = xstrdup(name);
+ mesh->self = new_node();
+ mesh->self->connection = new_connection();
+ if(!read_ecdsa_private_key(mesh))
+ return false;
pthread_mutex_init ( &(mesh->outpacketqueue_mutex), NULL);
pthread_mutex_init ( &(mesh->nodes_mutex), NULL);
mesh->threadstarted = false;
WSAStartup(MAKEWORD(2, 2), &wsa_state);
#endif
- // Setup up everything
- // TODO: we should not open listening sockets yet
-
- if(!setup_network(mesh))
- return meshlink_close(mesh), NULL;
return mesh;
}
fprintf(stderr, "No name given!\n");
return false;
}
+ // Setup up everything
+
+ if(!setup_network(mesh))
+ return meshlink_close(mesh), NULL;
// Start the main thread
exit_configuration(&mesh->config);
event_loop_exit(&mesh->loop);
+ free(mesh);
+
#ifdef HAVE_MINGW
WSACleanup();
#endif