]> git.meshlink.io Git - meshlink/blobdiff - examples/chat.c
Restart the mesh after a failed join() in the other examples as well.
[meshlink] / examples / chat.c
index c6d67fb5c1ba2c111d4c814fdc1971699dc85ccc..37e067345f1561c1ac3fda2cbb53147f7c6b1d4c 100644 (file)
@@ -65,12 +65,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) {