X-Git-Url: http://git.meshlink.io/?p=meshlink;a=blobdiff_plain;f=test%2Fchannels-udp-cornercases.c;h=0ae3755833f365ad7381958998b82c37754c44af;hp=ac373be6f388edd9921b6e666c0a1517edd81c11;hb=d1b43b5060795728b95b4ed3311b3398771cf34e;hpb=1a023116b9d5e9a8fa93e81fcef725fd7b343593 diff --git a/test/channels-udp-cornercases.c b/test/channels-udp-cornercases.c index ac373be6..0ae37558 100644 --- a/test/channels-udp-cornercases.c +++ b/test/channels-udp-cornercases.c @@ -101,7 +101,7 @@ int main(void) { // Start MeshLink and wait for the channel to become connected. start_meshlink_pair(a, b); - assert(wait_sync_flag(&channel_opened, 5)); + assert(wait_sync_flag(&channel_opened, 15)); // Re-initialize everything meshlink_channel_close(a, channel); @@ -123,7 +123,7 @@ int main(void) { assert(channel); meshlink_set_channel_poll_cb(a, channel, poll_cb); - assert(wait_sync_flag(&channel_opened, 5)); + assert(wait_sync_flag(&channel_opened, 15)); // Send a message to b @@ -144,6 +144,17 @@ int main(void) { wait_sync_flag(&b_responded, 1); wait_sync_flag(&b_closed, 1); + // Try to send data on a closed channel + + for(int i = 0; i < 10; i++) { + if(meshlink_channel_send(a, channel, "Hello", 5) == -1) { + break; + } + + assert(i != 9); + usleep(10000); + } + // Try to create a second channel struct sync_flag channel_polled;