From f45b2b5dbcd1fb7af7a92c54834b9cc3dd5326d4 Mon Sep 17 00:00:00 2001 From: Saverio Proto Date: Thu, 7 Aug 2014 14:18:38 +0000 Subject: [PATCH] Call meshlink_stop before meshlink_join in the chat program --- examples/chat.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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"); -- 2.39.5