X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fnet_setup.c;h=b289a76504da93fed6159e7a2f1c0651fc9949bc;hb=0298c10effe496200dc761a4a26d57fc01ee2cf8;hp=af49ea09944092fa0b2d90575cb660c0c290924b;hpb=8d4b96efb7955eaa96174af4804597f92e124041;p=meshlink diff --git a/src/net_setup.c b/src/net_setup.c index af49ea09..b289a765 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -93,6 +93,11 @@ bool node_read_public_key(meshlink_handle_t *mesh, node_t *n) { // While we are at it, read known address information if(!n->canonical_address) { n->canonical_address = packmsg_get_str_dup(&in); + + if(!*n->canonical_address) { + free(n->canonical_address); + n->canonical_address = NULL; + } } else { packmsg_skip_element(&in); } @@ -191,6 +196,12 @@ bool node_read_from_config(meshlink_handle_t *mesh, node_t *n, const config_t *c } n->canonical_address = packmsg_get_str_dup(&in); + + if(!*n->canonical_address) { + free(n->canonical_address); + n->canonical_address = NULL; + } + uint32_t count = packmsg_get_array(&in); for(uint32_t i = 0; i < count; i++) { @@ -522,12 +533,6 @@ static bool add_listen_sockets(meshlink_handle_t *mesh) { Configure node_t mesh->self and set up the local sockets (listen only) */ static bool setup_myself(meshlink_handle_t *mesh) { - /* Set some defaults */ - - mesh->maxtimeout = 900; - - /* Done */ - mesh->self->nexthop = mesh->self; node_add(mesh, mesh->self);