From 57e736b5be2052484eec44889586bd89a2724c71 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Fri, 3 Jan 2025 12:46:33 -0800 Subject: api: rename nng_send_aio and nng_recv_aio to nng_socket_send and nng_socket_recv This aligns more closely with the nng_ctx functions. --- src/sp/multistress_test.c | 36 ++++++++++++++++---------------- src/sp/protocol/bus0/bus_test.c | 10 ++++----- src/sp/protocol/pair0/pair0_test.c | 8 +++---- src/sp/protocol/pair1/pair1_test.c | 12 +++++------ src/sp/protocol/pipeline0/pull_test.c | 10 ++++----- src/sp/protocol/pipeline0/push_test.c | 14 ++++++------- src/sp/protocol/pubsub0/sub_test.c | 2 +- src/sp/protocol/pubsub0/xsub_test.c | 12 +++++------ src/sp/protocol/reqrep0/rep_test.c | 18 ++++++++-------- src/sp/protocol/reqrep0/req_test.c | 6 +++--- src/sp/protocol/reqrep0/reqstress_test.c | 16 +++++++------- src/sp/protocol/reqrep0/xrep_test.c | 6 +++--- src/sp/protocol/reqrep0/xreq_test.c | 4 ++-- src/sp/protocol/survey0/respond_test.c | 6 +++--- src/sp/protocol/survey0/survey_test.c | 2 +- src/sp/protocol/survey0/xrespond_test.c | 6 +++--- src/sp/protocol/survey0/xsurvey_test.c | 2 +- src/sp/reconnect_stress_test.c | 6 +++--- src/sp/transport/udp/udp_tran_test.c | 4 ++-- 19 files changed, 90 insertions(+), 90 deletions(-) (limited to 'src/sp') diff --git a/src/sp/multistress_test.c b/src/sp/multistress_test.c index 22e15ff3..5ffc4c4f 100644 --- a/src/sp/multistress_test.c +++ b/src/sp/multistress_test.c @@ -124,7 +124,7 @@ rep0_recd(void *arg) c->nrecv++; nng_aio_set_msg(c->sent, nng_aio_get_msg(c->recd)); nng_aio_set_msg(c->recd, NULL); - nng_send_aio(c->sock, c->sent); + nng_socket_send(c->sock, c->sent); } static void @@ -140,7 +140,7 @@ rep0_sent(void *arg) return; } c->nsend++; - nng_recv_aio(c->sock, c->recd); + nng_socket_recv(c->sock, c->recd); } static void @@ -162,7 +162,7 @@ req0_woke(void *arg) return; } nng_aio_set_msg(c->sent, msg); - nng_send_aio(c->sock, c->sent); + nng_socket_send(c->sock, c->sent); } static void @@ -205,7 +205,7 @@ req0_sent(void *arg) return; } c->nsend++; - nng_recv_aio(c->sock, c->recd); + nng_socket_recv(c->sock, c->recd); } void @@ -233,7 +233,7 @@ reqrep0_test(int ntests) fatal("nng_aio_alloc", rv); } - nng_recv_aio(srv->sock, srv->recd); + nng_socket_recv(srv->sock, srv->recd); for (i = 1; i < ntests; i++) { cli = &cases[curcase++]; @@ -279,7 +279,7 @@ pair0_recd(void *arg) } c->nrecv++; nng_msg_free(nng_aio_get_msg(c->recd)); - nng_recv_aio(c->sock, c->recd); + nng_socket_recv(c->sock, c->recd); } static void @@ -300,7 +300,7 @@ pair0_woke(void *arg) return; } nng_aio_set_msg(c->sent, msg); - nng_send_aio(c->sock, c->sent); + nng_socket_send(c->sock, c->sent); } static void @@ -358,8 +358,8 @@ pair0_test(int ntests) fatal("nng_dial", rv); } - nng_recv_aio(srv->sock, srv->recd); - nng_recv_aio(cli->sock, cli->recd); + nng_socket_recv(srv->sock, srv->recd); + nng_socket_recv(cli->sock, cli->recd); nng_sleep_aio(1, srv->woke); nng_sleep_aio(1, cli->woke); } @@ -379,7 +379,7 @@ bus0_recd(void *arg) } c->nrecv++; nng_msg_free(nng_aio_get_msg(c->recd)); - nng_recv_aio(c->sock, c->recd); + nng_socket_recv(c->sock, c->recd); } static void @@ -400,7 +400,7 @@ bus0_woke(void *arg) return; } nng_aio_set_msg(c->sent, msg); - nng_send_aio(c->sock, c->sent); + nng_socket_send(c->sock, c->sent); } static void @@ -457,7 +457,7 @@ bus0_test(int ntests) for (int i = 0; i < ntests; i++) { test_case *c = &cases[curcase++]; - nng_recv_aio(c->sock, c->recd); + nng_socket_recv(c->sock, c->recd); nng_sleep_aio(1, c->woke); } } @@ -480,7 +480,7 @@ pub0_woke(void *arg) return; } nng_aio_set_msg(c->sent, msg); - nng_send_aio(c->sock, c->sent); + nng_socket_send(c->sock, c->sent); } void @@ -511,7 +511,7 @@ sub0_recd(void *arg) c->nrecv++; nng_msg_free(nng_aio_get_msg(c->recd)); nng_aio_set_msg(c->recd, NULL); - nng_recv_aio(c->sock, c->recd); + nng_socket_recv(c->sock, c->recd); } void @@ -596,7 +596,7 @@ pubsub0_test(int ntests) fatal("nng_dial", rv); } - nng_recv_aio(cli->sock, cli->recd); + nng_socket_recv(cli->sock, cli->recd); } nng_sleep_aio(1, srv->woke); @@ -637,7 +637,7 @@ push0_woke(void *arg) return; } nng_aio_set_msg(c->sent, msg); - nng_send_aio(c->sock, c->sent); + nng_socket_send(c->sock, c->sent); } void @@ -653,7 +653,7 @@ pull0_recd(void *arg) c->nrecv++; nng_msg_free(nng_aio_get_msg(c->recd)); nng_aio_set_msg(c->recd, NULL); - nng_recv_aio(c->sock, c->recd); + nng_socket_recv(c->sock, c->recd); } void @@ -755,7 +755,7 @@ pipeline0_test(int ntests) fatal("nng_dial", rv); } - nng_recv_aio(cli->sock, cli->recd); + nng_socket_recv(cli->sock, cli->recd); } nng_sleep_aio(1, srv->woke); diff --git a/src/sp/protocol/bus0/bus_test.c b/src/sp/protocol/bus0/bus_test.c index 55231770..d8b71c63 100644 --- a/src/sp/protocol/bus0/bus_test.c +++ b/src/sp/protocol/bus0/bus_test.c @@ -153,7 +153,7 @@ test_bus_recv_cancel(void) NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); nng_aio_set_timeout(aio, SECOND); - nng_recv_aio(s1, aio); + nng_socket_recv(s1, aio); nng_aio_abort(aio, NNG_ECANCELED); nng_aio_wait(aio); @@ -172,7 +172,7 @@ test_bus_close_recv_abort(void) NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); nng_aio_set_timeout(aio, SECOND); - nng_recv_aio(s1, aio); + nng_socket_recv(s1, aio); NUTS_CLOSE(s1); nng_aio_wait(aio); @@ -195,12 +195,12 @@ test_bus_aio_stopped(void) nng_aio_stop(aio1); nng_aio_stop(aio2); - nng_recv_aio(s1, aio1); + nng_socket_recv(s1, aio1); nng_aio_wait(aio1); NUTS_FAIL(nng_aio_result(aio1), NNG_ESTOPPED); nng_aio_set_msg(aio2, msg); - nng_send_aio(s1, aio2); + nng_socket_send(s1, aio2); nng_aio_wait(aio2); NUTS_FAIL(nng_aio_result(aio2), NNG_ESTOPPED); @@ -221,7 +221,7 @@ test_bus_aio_canceled(void) NUTS_PASS(nng_msg_alloc(&msg, 0)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); - nng_recv_aio(s1, aio); + nng_socket_recv(s1, aio); nng_aio_cancel(aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ECANCELED); diff --git a/src/sp/protocol/pair0/pair0_test.c b/src/sp/protocol/pair0/pair0_test.c index dc3264be..6a530e99 100644 --- a/src/sp/protocol/pair0/pair0_test.c +++ b/src/sp/protocol/pair0/pair0_test.c @@ -210,7 +210,7 @@ test_pair0_send_stopped_aio(void) NUTS_PASS(nng_pair0_open(&s1)); nng_aio_set_msg(aio, msg); nng_aio_stop(aio); - nng_send_aio(s1, aio); + nng_socket_send(s1, aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ESTOPPED); nng_msg_free(msg); @@ -229,7 +229,7 @@ test_pair0_send_canceled_aio(void) NUTS_PASS(nng_msg_alloc(&msg, 0)); NUTS_PASS(nng_pair0_open(&s1)); nng_aio_set_msg(aio, msg); - nng_send_aio(s1, aio); + nng_socket_send(s1, aio); nng_aio_cancel(aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ECANCELED); @@ -247,7 +247,7 @@ test_pair0_recv_stopped_aio(void) NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); NUTS_PASS(nng_pair0_open(&s1)); nng_aio_stop(aio); - nng_recv_aio(s1, aio); + nng_socket_recv(s1, aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ESTOPPED); nng_aio_free(aio); @@ -262,7 +262,7 @@ test_pair0_recv_canceled_aio(void) NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); NUTS_PASS(nng_pair0_open(&s1)); - nng_recv_aio(s1, aio); + nng_socket_recv(s1, aio); nng_aio_cancel(aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ECANCELED); diff --git a/src/sp/protocol/pair1/pair1_test.c b/src/sp/protocol/pair1/pair1_test.c index 8ed6ccbf..8baf139b 100644 --- a/src/sp/protocol/pair1/pair1_test.c +++ b/src/sp/protocol/pair1/pair1_test.c @@ -1,5 +1,5 @@ // -// Copyright 2024 Staysail Systems, Inc. +// Copyright 2025 Staysail Systems, Inc. // Copyright 2017 Capitar IT Group BV // // This software is supplied under the terms of the MIT License, a @@ -9,7 +9,7 @@ // #include "nng/nng.h" -#include +#include "nuts.h" #define SECOND 1000 @@ -276,7 +276,7 @@ test_pair1_send_stopped_aio(void) NUTS_PASS(nng_pair1_open(&s1)); nng_aio_set_msg(aio, msg); nng_aio_stop(aio); - nng_send_aio(s1, aio); + nng_socket_send(s1, aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ESTOPPED); nng_msg_free(msg); @@ -295,7 +295,7 @@ test_pair1_send_canceled_aio(void) NUTS_PASS(nng_msg_alloc(&msg, 0)); NUTS_PASS(nng_pair1_open(&s1)); nng_aio_set_msg(aio, msg); - nng_send_aio(s1, aio); + nng_socket_send(s1, aio); nng_aio_cancel(aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ECANCELED); @@ -313,7 +313,7 @@ test_pair1_recv_stopped_aio(void) NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); NUTS_PASS(nng_pair1_open(&s1)); nng_aio_stop(aio); - nng_recv_aio(s1, aio); + nng_socket_recv(s1, aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ESTOPPED); nng_aio_free(aio); @@ -328,7 +328,7 @@ test_pair1_recv_canceled_aio(void) NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); NUTS_PASS(nng_pair1_open(&s1)); - nng_recv_aio(s1, aio); + nng_socket_recv(s1, aio); nng_aio_cancel(aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ECANCELED); diff --git a/src/sp/protocol/pipeline0/pull_test.c b/src/sp/protocol/pipeline0/pull_test.c index 131ff92c..8ed9cc0e 100644 --- a/src/sp/protocol/pipeline0/pull_test.c +++ b/src/sp/protocol/pipeline0/pull_test.c @@ -173,7 +173,7 @@ test_pull_recv_aio_stopped(void) NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); nng_aio_stop(aio); - nng_recv_aio(s, aio); + nng_socket_recv(s, aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ESTOPPED); NUTS_CLOSE(s); @@ -189,7 +189,7 @@ test_pull_recv_aio_canceled(void) NUTS_PASS(nng_pull0_open(&s)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); - nng_recv_aio(s, aio); + nng_socket_recv(s, aio); nng_aio_cancel(aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ECANCELED); @@ -206,7 +206,7 @@ test_pull_close_recv(void) NUTS_PASS(nng_pull0_open(&s)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); nng_aio_set_timeout(aio, 1000); - nng_recv_aio(s, aio); + nng_socket_recv(s, aio); NUTS_CLOSE(s); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ECLOSED); @@ -224,7 +224,7 @@ test_pull_recv_nonblock(void) NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); nng_aio_set_timeout(aio, 0); // Instant timeout - nng_recv_aio(s, aio); + nng_socket_recv(s, aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ETIMEDOUT); @@ -242,7 +242,7 @@ test_pull_recv_abort(void) NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); nng_aio_set_timeout(aio, 1000); - nng_recv_aio(s, aio); + nng_socket_recv(s, aio); nng_aio_abort(aio, NNG_EAMBIGUOUS); nng_aio_wait(aio); diff --git a/src/sp/protocol/pipeline0/push_test.c b/src/sp/protocol/pipeline0/push_test.c index 579178b5..c2a99fb5 100644 --- a/src/sp/protocol/pipeline0/push_test.c +++ b/src/sp/protocol/pipeline0/push_test.c @@ -250,7 +250,7 @@ test_push_send_aio_stopped(void) nng_aio_set_msg(aio, m); nng_aio_stop(aio); - nng_send_aio(s, aio); + nng_socket_send(s, aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ESTOPPED); NUTS_CLOSE(s); @@ -270,7 +270,7 @@ test_push_close_send(void) NUTS_PASS(nng_msg_alloc(&m, 0)); nng_aio_set_timeout(aio, 1000); nng_aio_set_msg(aio, m); - nng_send_aio(s, aio); + nng_socket_send(s, aio); NUTS_CLOSE(s); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ECLOSED); @@ -292,7 +292,7 @@ test_push_send_nonblock(void) nng_aio_set_timeout(aio, 0); // Instant timeout nng_aio_set_msg(aio, m); - nng_send_aio(s, aio); + nng_socket_send(s, aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ETIMEDOUT); @@ -314,7 +314,7 @@ test_push_send_timeout(void) nng_aio_set_timeout(aio, 10); nng_aio_set_msg(aio, m); - nng_send_aio(s, aio); + nng_socket_send(s, aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ETIMEDOUT); @@ -336,7 +336,7 @@ test_push_send_cancel(void) nng_aio_set_timeout(aio, 1000); nng_aio_set_msg(aio, m); - nng_send_aio(s, aio); + nng_socket_send(s, aio); nng_aio_abort(aio, NNG_ECANCELED); nng_aio_wait(aio); @@ -362,7 +362,7 @@ test_push_send_late_unbuffered(void) nng_aio_set_timeout(aio, 1000); nng_aio_set_msg(aio, m); - nng_send_aio(s, aio); + nng_socket_send(s, aio); NUTS_MARRY(s, pull); @@ -391,7 +391,7 @@ test_push_send_late_buffered(void) nng_aio_set_timeout(aio, 1000); nng_aio_set_msg(aio, m); - nng_send_aio(s, aio); + nng_socket_send(s, aio); NUTS_MARRY(s, pull); diff --git a/src/sp/protocol/pubsub0/sub_test.c b/src/sp/protocol/pubsub0/sub_test.c index 6899d47d..5c72b8bd 100644 --- a/src/sp/protocol/pubsub0/sub_test.c +++ b/src/sp/protocol/pubsub0/sub_test.c @@ -140,7 +140,7 @@ test_sub_recv_late(void) NUTS_MARRY(pub, sub); NUTS_TRUE(nuts_poll_fd(fd) == false); - nng_recv_aio(sub, aio); + nng_socket_recv(sub, aio); // But once we send messages, it is. // We have to send a request, in order to send a reply. diff --git a/src/sp/protocol/pubsub0/xsub_test.c b/src/sp/protocol/pubsub0/xsub_test.c index fd26467d..618703b5 100644 --- a/src/sp/protocol/pubsub0/xsub_test.c +++ b/src/sp/protocol/pubsub0/xsub_test.c @@ -111,7 +111,7 @@ test_xsub_recv_late(void) NUTS_MARRY(pub, sub); NUTS_TRUE(nuts_poll_fd(fd) == false); - nng_recv_aio(sub, aio); + nng_socket_recv(sub, aio); // But once we send messages, it is. // We have to send a request, in order to send a reply. @@ -182,7 +182,7 @@ test_xsub_recv_closed(void) NUTS_PASS(nng_sub0_open_raw(&sub)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); NUTS_CLOSE(sub); - nng_recv_aio(sub, aio); + nng_socket_recv(sub, aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ECLOSED); nng_aio_free(aio); @@ -197,7 +197,7 @@ test_xsub_close_recv(void) NUTS_PASS(nng_sub0_open_raw(&sub)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); nng_aio_set_timeout(aio, 1000); - nng_recv_aio(sub, aio); + nng_socket_recv(sub, aio); NUTS_CLOSE(sub); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ECLOSED); @@ -215,7 +215,7 @@ test_xsub_recv_nonblock(void) NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); nng_aio_set_timeout(aio, 0); // Instant timeout - nng_recv_aio(sub, aio); + nng_socket_recv(sub, aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ETIMEDOUT); @@ -335,7 +335,7 @@ test_xsub_recv_aio_stopped(void) NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); nng_aio_stop(aio); - nng_recv_aio(sub, aio); + nng_socket_recv(sub, aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ESTOPPED); NUTS_CLOSE(sub); @@ -351,7 +351,7 @@ test_xsub_recv_aio_canceled(void) NUTS_PASS(nng_sub0_open_raw(&sub)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); - nng_recv_aio(sub, aio); + nng_socket_recv(sub, aio); nng_aio_cancel(aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ECANCELED); diff --git a/src/sp/protocol/reqrep0/rep_test.c b/src/sp/protocol/reqrep0/rep_test.c index 29c5ee4c..7c788d96 100644 --- a/src/sp/protocol/reqrep0/rep_test.c +++ b/src/sp/protocol/reqrep0/rep_test.c @@ -163,8 +163,8 @@ test_rep_double_recv(void) NUTS_PASS(nng_aio_alloc(&aio1, NULL, NULL)); NUTS_PASS(nng_aio_alloc(&aio2, NULL, NULL)); - nng_recv_aio(s1, aio1); - nng_recv_aio(s1, aio2); + nng_socket_recv(s1, aio1); + nng_socket_recv(s1, aio2); nng_aio_wait(aio2); NUTS_FAIL(nng_aio_result(aio2), NNG_ESTATE); @@ -203,12 +203,12 @@ test_rep_huge_send(void) NUTS_SEND(req, "R"); NUTS_RECV(rep, "R"); nng_aio_set_msg(aio, m); - nng_send_aio(rep, aio); + nng_socket_send(rep, aio); nng_aio_wait(aio); NUTS_PASS(nng_aio_result(aio)); nng_aio_set_msg(aio, NULL); m = NULL; - nng_recv_aio(req, aio); + nng_socket_recv(req, aio); nng_aio_wait(aio); NUTS_PASS(nng_aio_result(aio)); m = nng_aio_get_msg(aio); @@ -260,12 +260,12 @@ test_rep_huge_send_socket(void) NUTS_SEND(req, "R"); NUTS_RECV(rep, "R"); nng_aio_set_msg(aio, m); - nng_send_aio(rep, aio); + nng_socket_send(rep, aio); nng_aio_wait(aio); NUTS_PASS(nng_aio_result(aio)); nng_aio_set_msg(aio, NULL); m = NULL; - nng_recv_aio(req, aio); + nng_socket_recv(req, aio); nng_aio_wait(aio); NUTS_PASS(nng_aio_result(aio)); m = nng_aio_get_msg(aio); @@ -306,7 +306,7 @@ test_rep_close_pipe_before_send(void) NUTS_MARRY(req, rep); NUTS_SEND(req, "test"); - nng_recv_aio(rep, aio1); + nng_socket_recv(rep, aio1); nng_aio_wait(aio1); NUTS_PASS(nng_aio_result(aio1)); NUTS_TRUE((m = nng_aio_get_msg(aio1)) != NULL); @@ -531,7 +531,7 @@ test_rep_close_recv(void) NUTS_MARRY(req, rep); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); - nng_recv_aio(rep, aio); + nng_socket_recv(rep, aio); NUTS_CLOSE(rep); NUTS_CLOSE(req); nng_aio_wait(aio); @@ -580,7 +580,7 @@ test_rep_close_recv_cb(void) NUTS_MARRY(req, rep); NUTS_PASS(nng_aio_alloc(&state.aio, rep_close_recv_cb, &state)); - nng_recv_aio(rep, state.aio); + nng_socket_recv(rep, state.aio); NUTS_CLOSE(rep); NUTS_CLOSE(req); nng_mtx_lock(state.mtx); diff --git a/src/sp/protocol/reqrep0/req_test.c b/src/sp/protocol/reqrep0/req_test.c index 13bab6ec..17378c89 100644 --- a/src/sp/protocol/reqrep0/req_test.c +++ b/src/sp/protocol/reqrep0/req_test.c @@ -337,7 +337,7 @@ test_req_disconnect_abort(void) NUTS_MARRY(rep1, req); NUTS_SEND(req, "ping"); NUTS_RECV(rep1, "ping"); - nng_recv_aio(req, aio); + nng_socket_recv(req, aio); NUTS_MARRY(rep2, req); NUTS_CLOSE(rep1); @@ -433,7 +433,7 @@ test_req_cancel_abort_recv(void) NUTS_SLEEP(100); nng_aio_set_timeout(aio, 5 * SECOND); - nng_recv_aio(req, aio); + nng_socket_recv(req, aio); // Give time for this recv to post properly. NUTS_SLEEP(100); @@ -565,7 +565,7 @@ test_req_poll_contention(void) NUTS_TRUE(nuts_poll_fd(fd) == false); nng_aio_set_msg(aio, msg); - nng_send_aio(req, aio); + nng_socket_send(req, aio); for (int i = 0; i < 5; i++) { nng_aio_set_msg(ctx_aio[i], ctx_msg[i]); nng_ctx_send(ctx[i], ctx_aio[i]); diff --git a/src/sp/protocol/reqrep0/reqstress_test.c b/src/sp/protocol/reqrep0/reqstress_test.c index 9c0861d8..2b2e1980 100644 --- a/src/sp/protocol/reqrep0/reqstress_test.c +++ b/src/sp/protocol/reqrep0/reqstress_test.c @@ -1,5 +1,5 @@ // -// Copyright 2024 Staysail Systems, Inc. +// Copyright 2025 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // // This software is supplied under the terms of the MIT License, a @@ -12,9 +12,9 @@ #include #include -#include +#include "nng/nng.h" -#include +#include "nuts.h" #ifdef NDEBUG #define dprintf(...) @@ -114,7 +114,7 @@ rep_recv_cb(void *arg) c->nrecv++; nng_aio_set_msg(c->send_aio, nng_aio_get_msg(c->recv_aio)); nng_aio_set_msg(c->recv_aio, NULL); - nng_send_aio(c->socket, c->send_aio); + nng_socket_send(c->socket, c->send_aio); } static void @@ -130,7 +130,7 @@ rep_send_cb(void *arg) return; } c->nsend++; - nng_recv_aio(c->socket, c->recv_aio); + nng_socket_recv(c->socket, c->recv_aio); } static void @@ -153,7 +153,7 @@ req_time_cb(void *arg) return; } nng_aio_set_msg(c->send_aio, msg); - nng_send_aio(c->socket, c->send_aio); + nng_socket_send(c->socket, c->send_aio); } static void @@ -196,7 +196,7 @@ req_send_cb(void *arg) return; } c->nsend++; - nng_recv_aio(c->socket, c->recv_aio); + nng_socket_recv(c->socket, c->recv_aio); } void @@ -224,7 +224,7 @@ reqrep_test(int ntests) fatal("nng_aio_alloc", rv); } - nng_recv_aio(srv->socket, srv->recv_aio); + nng_socket_recv(srv->socket, srv->recv_aio); for (i = 1; i < ntests; i++) { cli = &cases[curcase++]; diff --git a/src/sp/protocol/reqrep0/xrep_test.c b/src/sp/protocol/reqrep0/xrep_test.c index a00f78f7..d4e4ce26 100644 --- a/src/sp/protocol/reqrep0/xrep_test.c +++ b/src/sp/protocol/reqrep0/xrep_test.c @@ -171,7 +171,7 @@ test_xrep_close_pipe_before_send(void) NUTS_MARRY(req, rep); NUTS_SEND(req, "test"); - nng_recv_aio(rep, aio1); + nng_socket_recv(rep, aio1); nng_aio_wait(aio1); NUTS_PASS(nng_aio_result(aio1)); NUTS_TRUE((m = nng_aio_get_msg(aio1)) != NULL); @@ -265,7 +265,7 @@ test_xrep_recv_aio_stopped(void) NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); nng_aio_stop(aio); - nng_recv_aio(rep, aio); + nng_socket_recv(rep, aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ESTOPPED); NUTS_CLOSE(rep); @@ -281,7 +281,7 @@ test_xrep_recv_aio_canceled(void) NUTS_PASS(nng_rep0_open_raw(&rep)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); - nng_recv_aio(rep, aio); + nng_socket_recv(rep, aio); nng_aio_cancel(aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ECANCELED); diff --git a/src/sp/protocol/reqrep0/xreq_test.c b/src/sp/protocol/reqrep0/xreq_test.c index 28c79a26..7969ff0f 100644 --- a/src/sp/protocol/reqrep0/xreq_test.c +++ b/src/sp/protocol/reqrep0/xreq_test.c @@ -171,7 +171,7 @@ test_xreq_recv_aio_stopped(void) NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); nng_aio_stop(aio); - nng_recv_aio(req, aio); + nng_socket_recv(req, aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ESTOPPED); NUTS_CLOSE(req); @@ -190,7 +190,7 @@ test_xreq_send_aio_canceled(void) NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); nng_aio_set_msg(aio, msg); - nng_send_aio(req, aio); + nng_socket_send(req, aio); nng_aio_cancel(aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ECANCELED); diff --git a/src/sp/protocol/survey0/respond_test.c b/src/sp/protocol/survey0/respond_test.c index 0725efb7..5b4bcff9 100644 --- a/src/sp/protocol/survey0/respond_test.c +++ b/src/sp/protocol/survey0/respond_test.c @@ -163,8 +163,8 @@ test_resp_double_recv(void) NUTS_PASS(nng_aio_alloc(&aio1, NULL, NULL)); NUTS_PASS(nng_aio_alloc(&aio2, NULL, NULL)); - nng_recv_aio(s1, aio1); - nng_recv_aio(s1, aio2); + nng_socket_recv(s1, aio1); + nng_socket_recv(s1, aio2); nng_aio_wait(aio2); NUTS_FAIL(nng_aio_result(aio2), NNG_ESTATE); @@ -194,7 +194,7 @@ test_resp_close_pipe_before_send(void) NUTS_MARRY(surv, resp); NUTS_SEND(surv, "test"); - nng_recv_aio(resp, aio1); + nng_socket_recv(resp, aio1); nng_aio_wait(aio1); NUTS_PASS(nng_aio_result(aio1)); NUTS_TRUE((m = nng_aio_get_msg(aio1)) != NULL); diff --git a/src/sp/protocol/survey0/survey_test.c b/src/sp/protocol/survey0/survey_test.c index 1be9dee4..bf6fbb08 100644 --- a/src/sp/protocol/survey0/survey_test.c +++ b/src/sp/protocol/survey0/survey_test.c @@ -232,7 +232,7 @@ test_surv_cancel_abort_recv(void) NUTS_SLEEP(100); nng_aio_set_timeout(aio, 5 * SECOND); - nng_recv_aio(surv, aio); + nng_socket_recv(surv, aio); // Give time for this recv to post properly. NUTS_SLEEP(100); diff --git a/src/sp/protocol/survey0/xrespond_test.c b/src/sp/protocol/survey0/xrespond_test.c index 03ac5fc1..bda924c3 100644 --- a/src/sp/protocol/survey0/xrespond_test.c +++ b/src/sp/protocol/survey0/xrespond_test.c @@ -171,7 +171,7 @@ test_xresp_close_pipe_before_send(void) NUTS_MARRY(surv, resp); NUTS_SEND(surv, "test"); - nng_recv_aio(resp, aio1); + nng_socket_recv(resp, aio1); nng_aio_wait(aio1); NUTS_PASS(nng_aio_result(aio1)); NUTS_TRUE((m = nng_aio_get_msg(aio1)) != NULL); @@ -265,7 +265,7 @@ test_xresp_recv_aio_stopped(void) NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); nng_aio_stop(aio); - nng_recv_aio(resp, aio); + nng_socket_recv(resp, aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ESTOPPED); NUTS_CLOSE(resp); @@ -281,7 +281,7 @@ test_xresp_recv_aio_canceled(void) NUTS_PASS(nng_respondent0_open_raw(&resp)); NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); - nng_recv_aio(resp, aio); + nng_socket_recv(resp, aio); nng_aio_cancel(aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ECANCELED); diff --git a/src/sp/protocol/survey0/xsurvey_test.c b/src/sp/protocol/survey0/xsurvey_test.c index 44b2c990..1b9c52fd 100644 --- a/src/sp/protocol/survey0/xsurvey_test.c +++ b/src/sp/protocol/survey0/xsurvey_test.c @@ -170,7 +170,7 @@ test_xsurvey_recv_aio_stopped(void) NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); nng_aio_stop(aio); - nng_recv_aio(surv, aio); + nng_socket_recv(surv, aio); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ESTOPPED); NUTS_CLOSE(surv); diff --git a/src/sp/reconnect_stress_test.c b/src/sp/reconnect_stress_test.c index 685f8b98..3602a6db 100644 --- a/src/sp/reconnect_stress_test.c +++ b/src/sp/reconnect_stress_test.c @@ -53,7 +53,7 @@ work_send(struct work *w, void *data, size_t size) PASS(nng_msg_alloc(&msg, 0)); PASS(nng_msg_append(msg, data, size)); nng_aio_set_msg(w->aio, msg); - nng_send_aio(w->socket, w->aio); + nng_socket_send(w->socket, w->aio); } void @@ -120,7 +120,7 @@ ping_cb(void *arg) switch (w->state) { case SEND: w->state = RECV; - nng_recv_aio(w->socket, w->aio); + nng_socket_recv(w->socket, w->aio); break; case RECV: msg = nng_aio_get_msg(w->aio); @@ -138,7 +138,7 @@ void echo_start(struct work *w) { w->state = RECV; - nng_recv_aio(w->socket, w->aio); + nng_socket_recv(w->socket, w->aio); } void diff --git a/src/sp/transport/udp/udp_tran_test.c b/src/sp/transport/udp/udp_tran_test.c index b1c3b60a..8157c082 100644 --- a/src/sp/transport/udp/udp_tran_test.c +++ b/src/sp/transport/udp/udp_tran_test.c @@ -297,7 +297,7 @@ udp_recv_count_cb(void *arg) } nng_aio_set_timeout(c->aio, 1000); - nng_recv_aio(c->sock, c->aio); + nng_socket_recv(c->sock, c->aio); } // This test uses callbacks above to ensure we @@ -371,7 +371,7 @@ test_udp_multi_small_burst(void) rc.len = 95; rc.expect = msg; - nng_recv_aio(rc.sock, rc.aio); + nng_socket_recv(rc.sock, rc.aio); // Experimentally at least on Darwin, we see some packet losses // even for loopback. Loss rates appear depressingly high. -- cgit v1.2.3-70-g09d2