From b21d7805523a407a14567017edbdef57ca81781f Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 8 Jan 2020 20:34:26 -0800 Subject: fixes #1094 Consider in-lining task and aio This only does it for rep, but it also has changes that should increase the overall test coverage for the REP protocol --- src/protocol/reqrep0/rep_test.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/protocol/reqrep0/rep_test.c') diff --git a/src/protocol/reqrep0/rep_test.c b/src/protocol/reqrep0/rep_test.c index 879d6ae4..f339e68d 100644 --- a/src/protocol/reqrep0/rep_test.c +++ b/src/protocol/reqrep0/rep_test.c @@ -272,6 +272,26 @@ test_rep_close_pipe_during_send(void) TEST_NNG_PASS(nng_close(rep)); } +void +test_rep_ctx_recv_aio_stopped(void) +{ + nng_socket rep; + nng_ctx ctx; + nng_aio * aio; + + TEST_NNG_PASS(nng_rep0_open(&rep)); + TEST_NNG_PASS(nng_aio_alloc(&aio, NULL, NULL)); + TEST_NNG_PASS(nng_ctx_open(&ctx, rep)); + + nng_aio_stop(aio); + nng_ctx_recv(ctx, aio); + nng_aio_wait(aio); + TEST_NNG_FAIL(nng_aio_result(aio), NNG_ECANCELED); + TEST_NNG_PASS(nng_ctx_close(ctx)); + TEST_NNG_PASS(nng_close(rep)); + nng_aio_free(aio); +} + void test_rep_close_pipe_context_send(void) { @@ -424,6 +444,7 @@ TEST_LIST = { { "rep double recv", test_rep_double_recv }, { "rep close pipe before send", test_rep_close_pipe_before_send }, { "rep close pipe during send", test_rep_close_pipe_during_send }, + { "rep recv aio ctx stopped", test_rep_ctx_recv_aio_stopped }, { "rep close pipe context send", test_rep_close_pipe_context_send }, { "rep close context send", test_rep_close_context_send }, { "rep recv garbage", test_rep_recv_garbage }, -- cgit v1.2.3-70-g09d2