From bb6e35501cb2c39e52022416592c5869a2f0bf40 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Thu, 6 Jul 2017 22:04:00 +0200 Subject: [PATCH] Restart the mesh even after a failed join(). --- examples/channels.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/examples/channels.c b/examples/channels.c index 6d34de36..1fceb0b4 100644 --- a/examples/channels.c +++ b/examples/channels.c @@ -99,12 +99,11 @@ static void parse_command(meshlink_handle_t *mesh, char *buf) { meshlink_stop(mesh); if(!meshlink_join(mesh, arg)) fprintf(stderr, "Could not join using invitation: %s\n", meshlink_strerror(meshlink_errno)); - else { + else fprintf(stderr, "Invitation accepted!\n"); - if(!meshlink_start(mesh)) { - fprintf(stderr, "Could not start MeshLink: %s\n", meshlink_strerror(meshlink_errno)); - return; - } + if(!meshlink_start(mesh)) { + fprintf(stderr, "Could not restart MeshLink: %s\n", meshlink_strerror(meshlink_errno)); + exit(1); } } else if(!strcasecmp(buf, "kick")) { if(!arg) { -- 2.39.5