From 1ea408b6c313394078a551fe8839e84a787f34e7 Mon Sep 17 00:00:00 2001 From: Saverio Proto Date: Wed, 11 Jun 2014 21:12:40 +0200 Subject: [PATCH] Initialize mesh->self before network setup --- src/meshlink.c | 2 ++ src/net_setup.c | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) 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); -- 2.39.5