diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-11-02 13:57:53 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-11-02 14:47:50 -0700 |
| commit | 279180c1d07fc2c4c0bfa8f5a418cb02c4b87863 (patch) | |
| tree | b451ac7f845062674d6ab45eb5d530628d3ff47c /src/sp/protocol/survey0/survey_test.c | |
| parent | 9b27984d0e2da430b78a975e59f55c96de5f6056 (diff) | |
| download | nng-279180c1d07fc2c4c0bfa8f5a418cb02c4b87863.tar.gz nng-279180c1d07fc2c4c0bfa8f5a418cb02c4b87863.tar.bz2 nng-279180c1d07fc2c4c0bfa8f5a418cb02c4b87863.zip | |
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.
Diffstat (limited to 'src/sp/protocol/survey0/survey_test.c')
| -rw-r--r-- | src/sp/protocol/survey0/survey_test.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/src/sp/protocol/survey0/survey_test.c b/src/sp/protocol/survey0/survey_test.c index c5f699da..76fe138d 100644 --- a/src/sp/protocol/survey0/survey_test.c +++ b/src/sp/protocol/survey0/survey_test.c @@ -8,6 +8,7 @@ // found online at https://opensource.org/licenses/MIT. // +#include "nng/nng.h" #include <nuts.h> static void @@ -313,7 +314,7 @@ test_surv_poll_writeable(void) NUTS_PASS(nng_surveyor0_open(&surv)); NUTS_PASS(nng_respondent0_open(&resp)); - NUTS_PASS(nng_socket_get_int(surv, NNG_OPT_SENDFD, &fd)); + NUTS_PASS(nng_socket_get_send_poll_fd(surv, &fd)); NUTS_TRUE(fd >= 0); // Survey is broadcast, so we can always write. @@ -338,7 +339,7 @@ test_surv_poll_readable(void) NUTS_PASS(nng_surveyor0_open(&surv)); NUTS_PASS(nng_respondent0_open(&resp)); - NUTS_PASS(nng_socket_get_int(surv, NNG_OPT_RECVFD, &fd)); + NUTS_PASS(nng_socket_get_recv_poll_fd(surv, &fd)); NUTS_TRUE(fd >= 0); // Not readable if not connected! @@ -372,21 +373,6 @@ test_surv_poll_readable(void) } static void -test_surv_ctx_no_poll(void) -{ - int fd; - nng_socket surv; - nng_ctx ctx; - - NUTS_PASS(nng_surveyor0_open(&surv)); - NUTS_PASS(nng_ctx_open(&ctx, surv)); - 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(surv); -} - -static void test_surv_ctx_recv_nonblock(void) { nng_socket surv; @@ -639,7 +625,6 @@ TEST_LIST = { { "survey cancel post recv", test_surv_cancel_post_recv }, { "survey poll writable", test_surv_poll_writeable }, { "survey poll readable", test_surv_poll_readable }, - { "survey context does not poll", test_surv_ctx_no_poll }, { "survey context recv close socket", test_surv_ctx_recv_close_socket }, { "survey context recv nonblock", test_surv_ctx_recv_nonblock }, |
