+ int pmtu = meshlink_get_pmtu(mesh1, meshlink_get_node(mesh1, "baz"));
+
+ for(int i = 0; i < 10 && !pmtu; i++) {
+ sleep(1);
+ pmtu = meshlink_get_pmtu(mesh1, meshlink_get_node(mesh1, "baz"));
+ }
+
+ if(!pmtu) {
+ fprintf(stderr, "UDP communication with baz not possible after 10 seconds\n");
+ return 1;
+ }
+
+ // Check that an invitation cannot be used twice
+
+ if(meshlink_join(mesh3, baz_url)) {
+ fprintf(stderr, "Quux could join foo's mesh using an already used invitation\n");
+ return 1;
+ }
+
+ free(baz_url);
+
+ // Check that nodes cannot join with expired invitations
+
+ meshlink_set_invitation_timeout(mesh1, 0);
+
+ if(meshlink_join(mesh3, quux_url)) {
+ fprintf(stderr, "Quux could join foo's mesh using an outdated invitation\n");
+ return 1;
+ }
+
+ free(quux_url);
+
+ // Check that existing nodes cannot join another mesh
+
+ char *corge_url = meshlink_invite(mesh3, NULL, "corge");
+
+ if(!corge_url) {
+ fprintf(stderr, "Quux could not generate an invitation for corge\n");
+ return 1;
+ }
+
+ fprintf(stderr, "Invitation URL for corge: %s\n", corge_url);
+
+ if(!meshlink_start(mesh3)) {
+ fprintf(stderr, "Quux could not start\n");
+ return 1;
+ }