int main(int argc, char *argv[]) {
// Open two new meshlink instance.
- meshlink_handle_t *mesh1 = meshlink_open("invite_join_conf.1", "foo");
+ meshlink_handle_t *mesh1 = meshlink_open("invite_join_conf.1", "foo", "invite-join", DEV_CLASS_BACKBONE);
if(!mesh1) {
fprintf(stderr, "Could not initialize configuration for foo\n");
return 1;
}
- meshlink_handle_t *mesh2 = meshlink_open("invite_join_conf.2", "bar");
+ meshlink_handle_t *mesh2 = meshlink_open("invite_join_conf.2", "bar", "invite-join", DEV_CLASS_BACKBONE);
if(!mesh2) {
fprintf(stderr, "Could not initialize configuration for bar\n");
return 1;
}
+ // Disable local discovery.
+
+ meshlink_enable_discovery(mesh1, false);
+ meshlink_enable_discovery(mesh2, false);
+
// Start the first instance and have it generate an invitation.
meshlink_set_node_status_cb(mesh1, status_cb);
-
+
if(!meshlink_start(mesh1)) {
fprintf(stderr, "Foo could not start\n");
return 1;
return 1;
}
+ 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;
+ }
+
// Clean up.
meshlink_stop(mesh2);