]> git.meshlink.io Git - meshlink/blobdiff - examples/chatpp.cc
Don't call abort() when no channel receive callback is set.
[meshlink] / examples / chatpp.cc
index 33a1cac538f90d66ee12d8dddea59182c5d4b9f9..97f8740639836591beabb294b8b5c851df1e0a5e 100644 (file)
@@ -61,10 +61,17 @@ static void parse_command(meshlink::mesh *mesh, char *buf) {
                        return;
                }
 
+               mesh->stop();
+
                if(!mesh->join(arg))
                        fprintf(stderr, "Could not join using invitation: %s\n", meshlink::strerror());
                else
                        fprintf(stderr, "Invitation accepted!\n");
+
+               if(!mesh->start()) {
+                       fprintf(stderr, "Could not restart MeshLink: %s\n", meshlink::strerror());
+                       exit(1);
+               }
        } else if(!strcasecmp(buf, "kick")) {
                if(!arg) {
                        fprintf(stderr, "/kick requires an argument!\n");