]> git.meshlink.io Git - meshlink/blobdiff - test/trio2.c
Fix assert that could incorrectly be triggered when a peer closed the channel.
[meshlink] / test / trio2.c
index c21cba223a5b546bbc6838963bcb02cfc2d39304..328c6a95961a4c95153f3f859d68e8d10afc4ba6 100644 (file)
@@ -1,5 +1,9 @@
 #define _GNU_SOURCE
 
+#ifdef NDEBUG
+#undef NDEBUG
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -43,7 +47,7 @@ static void baz_status_cb(meshlink_handle_t *mesh, meshlink_node_t *node, bool r
        }
 }
 
-int main() {
+int main(void) {
        meshlink_set_log_cb(NULL, MESHLINK_DEBUG, log_cb);
 
        // Create three instances.
@@ -61,7 +65,7 @@ int main() {
                assert(mesh[i]);
                free(path);
 
-               meshlink_add_address(mesh[i], "localhost");
+               assert(meshlink_set_canonical_address(mesh[i], meshlink_get_self(mesh[i]), "localhost", NULL));
 
                data[i] = meshlink_export(mesh[i]);
                assert(data[i]);