]> git.meshlink.io Git - meshlink/commitdiff
Restart the mesh even after a failed join().
authorGuus Sliepen <guus@meshlink.io>
Thu, 6 Jul 2017 20:04:00 +0000 (22:04 +0200)
committerGuus Sliepen <guus@meshlink.io>
Thu, 6 Jul 2017 20:04:00 +0000 (22:04 +0200)
examples/channels.c

index 6d34de360b2991e3bc985d2dff5d23ef68b419e6..1fceb0b4594ce7948d873cf0a942380a3bee70de 100644 (file)
@@ -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) {