X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=test%2Fchannels-no-partial.c;h=43792be39ec7a671034995cdef47a94e61777457;hb=bc2e55e940e45748a49f1a7eb44b156917fca469;hp=bcf8cec1be8946dc2408a4651b795f4bf2b7f1ad;hpb=f1da50294494310d7a299c29af5649d4415bd38a;p=meshlink diff --git a/test/channels-no-partial.c b/test/channels-no-partial.c index bcf8cec1..43792be3 100644 --- a/test/channels-no-partial.c +++ b/test/channels-no-partial.c @@ -68,11 +68,24 @@ int main(int argc, char *argv[]) { // Restart a to ensure it gets to flush the channel send queue. - meshlink_start(mesh_a); + assert(meshlink_start(mesh_a)); assert_after(!meshlink_channel_get_sendq(mesh_a, channel), 30); assert(meshlink_channel_send(mesh_a, channel, buf, 512) == 512); + // Check that we can change the NO_PARTIAL flag + + assert_after(!meshlink_channel_get_sendq(mesh_a, channel), 30); + meshlink_set_channel_sndbuf(mesh_a, channel, 256); + assert(meshlink_channel_send(mesh_a, channel, buf, 257) == -1); + meshlink_set_channel_flags(mesh_a, channel, 0); + assert(meshlink_channel_send(mesh_a, channel, buf, 257) == 256); + + assert_after(!meshlink_channel_get_sendq(mesh_a, channel), 30); + meshlink_set_channel_flags(mesh_a, channel, MESHLINK_CHANNEL_NO_PARTIAL); + assert(meshlink_channel_send(mesh_a, channel, buf, 257) == -1); + assert(meshlink_channel_send(mesh_a, channel, buf, 256) == 256); + // Clean up. close_meshlink_pair(mesh_a, mesh_b);