From: Saverio Proto Date: Wed, 11 Jun 2014 19:12:40 +0000 (+0200) Subject: Initialize mesh->self before network setup X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=1ea408b6c313394078a551fe8839e84a787f34e7;p=meshlink Initialize mesh->self before network setup --- diff --git a/src/meshlink.c b/src/meshlink.c index c703ddbe..31f2410c 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -737,6 +737,8 @@ meshlink_handle_t *meshlink_open(const char *confbase, const char *name) { 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(); pthread_mutex_init ( &(mesh->outpacketqueue_mutex), NULL); pthread_mutex_init ( &(mesh->nodes_mutex), NULL); mesh->threadstarted = false; diff --git a/src/net_setup.c b/src/net_setup.c index e8ed9487..4ee4b953 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -273,8 +273,6 @@ bool setup_myself(meshlink_handle_t *mesh) { return false; } - mesh->self = new_node(); - mesh->self->connection = new_connection(); mesh->self->name = name; mesh->self->connection->name = xstrdup(name); read_host_config(mesh, mesh->config, name);