From 279180c1d07fc2c4c0bfa8f5a418cb02c4b87863 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 2 Nov 2024 13:57:53 -0700 Subject: NNG_OPT_RECVFD and NNG_OPT_SENDFD converted to functions. These options are removed entirely, and their functionality is now available via special functions, `nng_socket_get_send_poll_fd` and `nng_socket_get_recv_poll_fd`, making these first class methods on the socket. This eliminates a bit of wasteful code, and provides type safety for these methods. --- src/sp/protocol/reqrep0/rep_test.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'src/sp/protocol/reqrep0/rep_test.c') diff --git a/src/sp/protocol/reqrep0/rep_test.c b/src/sp/protocol/reqrep0/rep_test.c index 1a535998..58a54afe 100644 --- a/src/sp/protocol/reqrep0/rep_test.c +++ b/src/sp/protocol/reqrep0/rep_test.c @@ -54,7 +54,7 @@ test_rep_poll_writeable(void) NUTS_PASS(nng_req0_open(&req)); NUTS_PASS(nng_rep0_open(&rep)); - NUTS_PASS(nng_socket_get_int(rep, NNG_OPT_SENDFD, &fd)); + NUTS_PASS(nng_socket_get_send_poll_fd(rep, &fd)); NUTS_TRUE(fd >= 0); // Not writable before connect. @@ -91,7 +91,7 @@ test_rep_poll_readable(void) NUTS_PASS(nng_req0_open(&req)); NUTS_PASS(nng_rep0_open(&rep)); - NUTS_PASS(nng_socket_get_int(rep, NNG_OPT_RECVFD, &fd)); + NUTS_PASS(nng_socket_get_recv_poll_fd(rep, &fd)); NUTS_TRUE(fd >= 0); // Not readable if not connected! @@ -119,21 +119,6 @@ test_rep_poll_readable(void) NUTS_CLOSE(rep); } -void -test_rep_context_no_poll(void) -{ - int fd; - nng_socket req; - nng_ctx ctx; - - NUTS_PASS(nng_rep0_open(&req)); - NUTS_PASS(nng_ctx_open(&ctx, req)); - NUTS_FAIL(nng_ctx_get_int(ctx, NNG_OPT_SENDFD, &fd), NNG_ENOTSUP); - NUTS_FAIL(nng_ctx_get_int(ctx, NNG_OPT_RECVFD, &fd), NNG_ENOTSUP); - NUTS_PASS(nng_ctx_close(ctx)); - NUTS_CLOSE(req); -} - void test_rep_validate_peer(void) { @@ -763,7 +748,6 @@ NUTS_TESTS = { { "rep send bad state", test_rep_send_bad_state }, { "rep poll readable", test_rep_poll_readable }, { "rep poll writable", test_rep_poll_writeable }, - { "rep context does not poll", test_rep_context_no_poll }, { "rep validate peer", test_rep_validate_peer }, { "rep huge send", test_rep_huge_send }, { "rep huge send socket", test_rep_huge_send_socket }, -- cgit v1.2.3-70-g09d2