X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;ds=sidebyside;f=examples%2Fchatpp.cc;h=97f8740639836591beabb294b8b5c851df1e0a5e;hb=e2cae2e00c821190a72c227c27fc37b8b3ab35f8;hp=33a1cac538f90d66ee12d8dddea59182c5d4b9f9;hpb=fe1a9111456a73a6e690927e90d8bfa1e1d0ad22;p=meshlink diff --git a/examples/chatpp.cc b/examples/chatpp.cc index 33a1cac5..97f87406 100644 --- a/examples/chatpp.cc +++ b/examples/chatpp.cc @@ -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");