X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=test%2Fimport-export.c;fp=test%2Fimport-export.c;h=8330f05f79fb77c066e9047026da6691030ebc58;hb=668664d0ea90dc81670cccd7b7d56b36b8360eaa;hp=411a7a21ce0e3b4575dc5521fc8108158a8796d4;hpb=b67296418c51784d39a24c3041e2cb199bee06f2;p=meshlink diff --git a/test/import-export.c b/test/import-export.c index 411a7a21..8330f05f 100644 --- a/test/import-export.c +++ b/test/import-export.c @@ -8,20 +8,23 @@ volatile bool bar_reachable = false; void status_cb(meshlink_handle_t *mesh, meshlink_node_t *node, bool reachable) { - if(!strcmp(node->name, "bar")) + if(!strcmp(node->name, "bar")) { bar_reachable = reachable; + } } int main(int argc, char *argv[]) { // Open two new meshlink instance. meshlink_handle_t *mesh1 = meshlink_open("import_export_conf.1", "foo", "import-export", DEV_CLASS_BACKBONE); + if(!mesh1) { fprintf(stderr, "Could not initialize configuration for foo\n"); return 1; } meshlink_handle_t *mesh2 = meshlink_open("import_export_conf.2", "bar", "import-export", DEV_CLASS_BACKBONE); + if(!mesh2) { fprintf(stderr, "Could not initialize configuration for bar\n"); return 1; @@ -38,6 +41,7 @@ int main(int argc, char *argv[]) { meshlink_add_address(mesh2, "localhost"); char *data = meshlink_export(mesh1); + if(!data) { fprintf(stderr, "Foo could not export its configuration\n"); return 1; @@ -51,6 +55,7 @@ int main(int argc, char *argv[]) { free(data); data = meshlink_export(mesh2); + if(!data) { fprintf(stderr, "Bar could not export its configuration\n"); return 1; @@ -82,8 +87,10 @@ int main(int argc, char *argv[]) { for(int i = 0; i < 20; i++) { sleep(1); - if(bar_reachable) + + if(bar_reachable) { break; + } } if(!bar_reachable) { @@ -92,6 +99,7 @@ int main(int argc, char *argv[]) { } int pmtu = meshlink_get_pmtu(mesh2, meshlink_get_node(mesh2, "bar")); + for(int i = 0; i < 10 && !pmtu; i++) { sleep(1); pmtu = meshlink_get_pmtu(mesh2, meshlink_get_node(mesh2, "bar"));