From: Saverio Proto Date: Thu, 7 Aug 2014 14:18:38 +0000 (+0000) Subject: Call meshlink_stop before meshlink_join in the chat program X-Git-Url: http://git.meshlink.io/?p=meshlink;a=commitdiff_plain;h=f45b2b5dbcd1fb7af7a92c54834b9cc3dd5326d4;ds=sidebyside Call meshlink_stop before meshlink_join in the chat program --- diff --git a/examples/chat.c b/examples/chat.c index ace1e783..1a334328 100644 --- a/examples/chat.c +++ b/examples/chat.c @@ -56,11 +56,16 @@ static void parse_command(meshlink_handle_t *mesh, char *buf) { fprintf(stderr, "/join requires an argument!\n"); return; } - + 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 1; + } + } } else if(!strcasecmp(buf, "kick")) { if(!arg) { fprintf(stderr, "/kick requires an argument!\n");