]> git.meshlink.io Git - meshlink/commitdiff
Set a very small channel timeout in channels-failure test.
authorGuus Sliepen <guus@meshlink.io>
Sun, 13 Oct 2019 12:31:14 +0000 (14:31 +0200)
committerGuus Sliepen <guus@meshlink.io>
Sun, 13 Oct 2019 12:31:14 +0000 (14:31 +0200)
This tests both the meshlink_set_node_channel_timeout() function and greatly
speeds up the test.

test/channels-failure.c

index 34018e1124e472162cea5ec103068c5aa0da8d32..18aef2d5e3453ae300170f001f8ce04f3dd984ee 100644 (file)
@@ -72,11 +72,15 @@ int main() {
 
        sleep(1);
 
+       // Set a very small timeout for channels to b.
+
+       meshlink_set_node_channel_timeout(mesh_a, b, 1);
+
        // Stop mesh_b. We should get a notification that the channel has closed after a while.
 
        meshlink_stop(mesh_b);
 
-       assert(wait_sync_flag(&receive_flag, 70));
+       assert(wait_sync_flag(&receive_flag, 5));
        assert(receive_len == 0);
 
        meshlink_channel_close(mesh_a, channel);
@@ -91,7 +95,7 @@ int main() {
 
        meshlink_set_channel_poll_cb(mesh_a, channel, poll_cb);
 
-       assert(wait_sync_flag(&poll_flag, 70));
+       assert(wait_sync_flag(&poll_flag, 5));
        assert(poll_len == 0);
 
        // Clean up.