aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--demo/raw/raw.c12
-rw-r--r--docs/ref/api/ctx.md2
-rw-r--r--docs/ref/api/sock.md26
-rw-r--r--docs/ref/migrate/nng1.md13
-rw-r--r--docs/ref/xref.md4
-rw-r--r--include/nng/nng.h14
-rw-r--r--src/core/aio_test.c18
-rw-r--r--src/nng.c4
-rw-r--r--src/sp/multistress_test.c36
-rw-r--r--src/sp/protocol/bus0/bus_test.c10
-rw-r--r--src/sp/protocol/pair0/pair0_test.c8
-rw-r--r--src/sp/protocol/pair1/pair1_test.c12
-rw-r--r--src/sp/protocol/pipeline0/pull_test.c10
-rw-r--r--src/sp/protocol/pipeline0/push_test.c14
-rw-r--r--src/sp/protocol/pubsub0/sub_test.c2
-rw-r--r--src/sp/protocol/pubsub0/xsub_test.c12
-rw-r--r--src/sp/protocol/reqrep0/rep_test.c18
-rw-r--r--src/sp/protocol/reqrep0/req_test.c6
-rw-r--r--src/sp/protocol/reqrep0/reqstress_test.c16
-rw-r--r--src/sp/protocol/reqrep0/xrep_test.c6
-rw-r--r--src/sp/protocol/reqrep0/xreq_test.c4
-rw-r--r--src/sp/protocol/survey0/respond_test.c6
-rw-r--r--src/sp/protocol/survey0/survey_test.c2
-rw-r--r--src/sp/protocol/survey0/xrespond_test.c6
-rw-r--r--src/sp/protocol/survey0/xsurvey_test.c2
-rw-r--r--src/sp/reconnect_stress_test.c6
-rw-r--r--src/sp/transport/udp/udp_tran_test.c4
27 files changed, 140 insertions, 133 deletions
diff --git a/demo/raw/raw.c b/demo/raw/raw.c
index 3cb02169..222e4a48 100644
--- a/demo/raw/raw.c
+++ b/demo/raw/raw.c
@@ -67,17 +67,17 @@ server_cb(void *arg)
switch (work->state) {
case INIT:
work->state = RECV;
- nng_recv_aio(work->sock, work->aio);
+ nng_socket_recv(work->sock, work->aio);
break;
case RECV:
if ((rv = nng_aio_result(work->aio)) != 0) {
- fatal("nng_recv_aio", rv);
+ fatal("nng_socket_recv", rv);
}
msg = nng_aio_get_msg(work->aio);
if ((rv = nng_msg_trim_u32(msg, &when)) != 0) {
// bad message, just ignore it.
nng_msg_free(msg);
- nng_recv_aio(work->sock, work->aio);
+ nng_socket_recv(work->sock, work->aio);
return;
}
work->msg = msg;
@@ -89,15 +89,15 @@ server_cb(void *arg)
nng_aio_set_msg(work->aio, work->msg);
work->msg = NULL;
work->state = SEND;
- nng_send_aio(work->sock, work->aio);
+ nng_socket_send(work->sock, work->aio);
break;
case SEND:
if ((rv = nng_aio_result(work->aio)) != 0) {
nng_msg_free(work->msg);
- fatal("nng_send_aio", rv);
+ fatal("nng_socket_send", rv);
}
work->state = RECV;
- nng_recv_aio(work->sock, work->aio);
+ nng_socket_recv(work->sock, work->aio);
break;
default:
fatal("bad state!", NNG_ESTATE);
diff --git a/docs/ref/api/ctx.md b/docs/ref/api/ctx.md
index f1157def..b64ed3a1 100644
--- a/docs/ref/api/ctx.md
+++ b/docs/ref/api/ctx.md
@@ -150,7 +150,7 @@ The `nng_ctx_recvmsg` function receives a message and stores a pointer to the [`
The _flags_ can contain the value [`NNG_FLAG_NONBLOCK`], indicating that the function should not wait if the socket
has no messages available to receive. In such a case, it will return [`NNG_EAGAIN`].
-### nng_recv_aio
+### nng_socket_recv
The `nng_ctx_send` function receives a message asynchronously, using the [`nng_aio`] _aio_, over the context _ctx_.
On success, the received message can be retrieved from the _aio_ using the [`nng_aio_get_msg`] function.
diff --git a/docs/ref/api/sock.md b/docs/ref/api/sock.md
index 61a88ab5..4ebd8051 100644
--- a/docs/ref/api/sock.md
+++ b/docs/ref/api/sock.md
@@ -154,10 +154,10 @@ a result of [`NNG_ECLOSED`].
```c
int nng_send(nng_socket s, void *data, size_t size, int flags);
int nng_sendmsg(nng_socket s, nng_msg *msg, int flags);
-void nng_send_aio(nng_socket s, nng_aio *aio);
+void nng_socket_send(nng_socket s, nng_aio *aio);
```
-These functions ({{i:`nng_send`}}, {{i:`nng_sendmsg`}}, and {{i:`nng_send_aio`}}) send
+These functions ({{i:`nng_send`}}, {{i:`nng_sendmsg`}}, and {{i:`nng_socket_send`}}) send
messages over the socket _s_. The differences in their behaviors are as follows.
> [!NOTE]
@@ -198,9 +198,9 @@ cannot accept more data for sending. In such a case, it will return [`NNG_EAGAIN
> This function is preferred over [`nng_send`], as it gives access to the message structure and eliminates both
> a data copy and allocation.
-### nng_send_aio
+### nng_socket_send
-The `nng_send_aio` function sends a message asynchronously, using the [`nng_aio`] _aio_, over the socket _s_.
+The `nng_socket_send` function sends a message asynchronously, using the [`nng_aio`] _aio_, over the socket _s_.
The message to send must have been set on _aio_ using the [`nng_aio_set_msg`] function.
If the operation completes successfully, then the socket will have disposed of the message.
@@ -220,10 +220,10 @@ For example, the message may be sitting in queue, or located in TCP buffers, or
```c
int nng_recv(nng_socket s, void *data, size_t *sizep, int flags);
int nng_recvmsg(nng_socket s, nng_msg **msgp, int flags);
-void nng_recv_aio(nng_socket s, nng_aio *aio);
+void nng_socket_recv(nng_socket s, nng_aio *aio);
```
-These functions ({{i:`nng_recv`}}, {{i:`nng_recvmsg`}}, and {{i:`nng_recv_aio`}}) receive
+These functions ({{i:`nng_recv`}}, {{i:`nng_recvmsg`}}, and {{i:`nng_socket_recv`}}) receive
messages over the socket _s_. The differences in their behaviors are as follows.
> [!NOTE]
@@ -257,9 +257,9 @@ has no messages available to receive. In such a case, it will return [`NNG_EAGAI
> This function is preferred over [`nng_recv`], as it gives access to the message structure and eliminates both
> a data copy and allocation.
-### nng_recv_aio
+### nng_socket_recv
-The `nng_send_aio` function receives a message asynchronously, using the [`nng_aio`] _aio_, over the socket _s_.
+The `nng_socket_send` function receives a message asynchronously, using the [`nng_aio`] _aio_, over the socket _s_.
On success, the received message can be retrieved from the _aio_ using the [`nng_aio_get_msg`] function.
> [!NOTE]
@@ -371,7 +371,7 @@ nng_socket s = NNG_SOCKET_INITIALIZER;
### Example 2: Publishing a Timestamp
-This example demonstrates the use of [`nng_aio`], [`nng_send_aio`], and [`nng_sleep_aio`] to
+This example demonstrates the use of [`nng_aio`], [`nng_socket_send`], and [`nng_sleep_aio`] to
build a service that publishes a timestamp at one second intervals. Error handling is elided for the
sake of clarity.
@@ -403,7 +403,7 @@ void callback(void *arg) {
now = nng_clock();
nng_msg_append(msg, &now, sizeof (now)); // note: native endian
nng_aio_set_msg(state->aio, msg);
- nng_send_aio(state->s, state->aio);
+ nng_socket_send(state->s, state->aio);
} else {
state->sleeping = true;
nng_sleep_aio(1000, state->aio); // 1000 ms == 1 second
@@ -426,7 +426,7 @@ int main(int argc, char **argv) {
### Example 3: Watching a Periodic Timestamp
-This example demonstrates the use of [`nng_aio`], [`nng_recv_aio`], to build a client to
+This example demonstrates the use of [`nng_aio`], [`nng_socket_recv`], to build a client to
watch for messages received from the service created in Example 2.
Error handling is elided for the sake of clarity.
@@ -457,7 +457,7 @@ void callback(void *arg) {
printf("Timestamp is %lu\n", (unsigned long)now);
nng_msg_free(msg);
nng_aio_set_msg(state->aio, NULL);
- nng_recv_aio(state->s, state->aio);
+ nng_socket_recv(state->s, state->aio);
}
int main(int argc, char **argv) {
@@ -467,7 +467,7 @@ int main(int argc, char **argv) {
nng_sub0_open(&state.s);
nng_sub0_socket_subscribe(state.s, NULL, 0); // subscribe to everything
nng_dial(state.s, url, NULL, 0);
- nng_recv_aio(state.s, state.aio); // kick it off right away
+ nng_socket_recv(state.s, state.aio); // kick it off right away
for(;;) {
nng_msleep(0x7FFFFFFF); // infinite, could use pause or sigsuspend
}
diff --git a/docs/ref/migrate/nng1.md b/docs/ref/migrate/nng1.md
index 8306e71f..74350ec0 100644
--- a/docs/ref/migrate/nng1.md
+++ b/docs/ref/migrate/nng1.md
@@ -15,9 +15,14 @@ This is done using the [`nng_init`] function.
## Renamed Functions
-The `nng_close` function has been renamed to [`nng_socket_close`] to make it clearer that
-the object being closed is a socket. A compatible `nng_close` macro is available by defining `NNG1_TRANSITION`
-in your compilation environment.
+The following functions have been renamed as described by the following table.
+The old names are available by defining the macro `NNG1_TRANSITION` in your compilation environment.
+
+| Old Name | New Name |
+| -------------- | -------------------- |
+| `nng_close` | [`nng_socket_close`] |
+| `nng_recv_aio` | [`nng_socket_recv`] |
+| `nng_send_aio` | [`nng_socket_send`] |
## Removed Protocol Aliases
@@ -46,7 +51,7 @@ The `NNG_FLAG_ALLOC` flag that allowed a zero copy semantic with [`nng_send`] an
This was implemented mostly to aid legacy nanomsg applications, and it was both error prone and still a bit
suboptimal in terms of performance.
-Modern code should use one of [`nng_sendmsg`], [`nng_recvmsg`], [`nng_send_aio`], or [`nng_recv_aio`] to get the maximum performance benefit.
+Modern code should use one of [`nng_sendmsg`], [`nng_recvmsg`], [`nng_socket_send`], or [`nng_socket_recv`] to get the maximum performance benefit.
Working directly with [`nng_msg`] structures gives more control, reduces copies, and reduces allocation activity.
## New AIO Error Code NNG_ESTOPPED
diff --git a/docs/ref/xref.md b/docs/ref/xref.md
index 62f09540..f117edf7 100644
--- a/docs/ref/xref.md
+++ b/docs/ref/xref.md
@@ -223,10 +223,10 @@
[`nng_socket_get_size`]: /api/sock.md#socket-options
[`nng_send`]: /api/sock.md#nng_send
[`nng_sendmsg`]: /api/sock.md#nng_sendmsg
-[`nng_send_aio`]: /api/sock.md#nng_send_aio
+[`nng_socket_send`]: /api/sock.md#nng_socket_send
[`nng_recv`]: /api/sock.md#nng_recv
[`nng_recvmsg`]: /api/sock.md#nng_recvmsg
-[`nng_recv_aio`]: /api/sock.md#nng_recv_aio
+[`nng_socket_recv`]: /api/sock.md#nng_socket_recv
[`nng_ctx_open`]: /api/ctx.md#creating-a-context
[`nng_ctx_id`]: /api/ctx.md#context-identity
[`nng_ctx_close`]: /api/ctx.md#closing-a-context
diff --git a/include/nng/nng.h b/include/nng/nng.h
index 9ae38817..7bfb2c27 100644
--- a/include/nng/nng.h
+++ b/include/nng/nng.h
@@ -405,19 +405,19 @@ NNG_DECL int nng_sendmsg(nng_socket, nng_msg *, int);
// can be passed off directly to nng_sendmsg.
NNG_DECL int nng_recvmsg(nng_socket, nng_msg **, int);
-// nng_send_aio sends data on the socket asynchronously. As with nng_send,
+// nng_socket_send sends data on the socket asynchronously. As with nng_send,
// the completion may be executed before the data has actually been delivered,
// but only when it is accepted for delivery. The supplied AIO must have
// been initialized, and have an associated message. The message will be
// "owned" by the socket if the operation completes successfully. Otherwise,
// the caller is responsible for freeing it.
-NNG_DECL void nng_send_aio(nng_socket, nng_aio *);
+NNG_DECL void nng_socket_send(nng_socket, nng_aio *);
-// nng_recv_aio receives data on the socket asynchronously. On a successful
+// nng_socket_recv receives data on the socket asynchronously. On a successful
// result, the AIO will have an associated message, that can be obtained
// with nng_aio_get_msg(). The caller takes ownership of the message at
// this point.
-NNG_DECL void nng_recv_aio(nng_socket, nng_aio *);
+NNG_DECL void nng_socket_recv(nng_socket, nng_aio *);
// Context support. User contexts are not supported by all protocols,
// but for those that do, they give a way to create multiple contexts
@@ -442,7 +442,7 @@ NNG_DECL int nng_ctx_close(nng_ctx);
// A valid context is not necessarily an *open* context.
NNG_DECL int nng_ctx_id(nng_ctx);
-// nng_ctx_recv receives asynchronously. It works like nng_recv_aio, but
+// nng_ctx_recv receives asynchronously. It works like nng_socket_recv, but
// uses a local context instead of the socket global context.
NNG_DECL void nng_ctx_recv(nng_ctx, nng_aio *);
@@ -451,7 +451,7 @@ NNG_DECL void nng_ctx_recv(nng_ctx, nng_aio *);
// on a context instead of a socket.
NNG_DECL int nng_ctx_recvmsg(nng_ctx, nng_msg **, int);
-// nng_ctx_send sends asynchronously. It works like nng_send_aio, but
+// nng_ctx_send sends asynchronously. It works like nng_socket_send, but
// uses a local context instead of the socket global context.
NNG_DECL void nng_ctx_send(nng_ctx, nng_aio *);
@@ -1654,6 +1654,8 @@ NNG_DECL int nng_surveyor0_open_raw(nng_socket *);
do { \
} while (0)
#define nng_close(s) nng_socket_close(s)
+#define nng_send_aio(s, a) nng_socket_send(s, a)
+#define nng_recv_aio(s, a) nng_socket_recv(s, a)
#define nng_inproc_register() nng_nop()
#define nng_ipc_register() nng_nop()
#define nng_tls_register() nng_nop()
diff --git a/src/core/aio_test.c b/src/core/aio_test.c
index d8d70e12..01765dce 100644
--- a/src/core/aio_test.c
+++ b/src/core/aio_test.c
@@ -1,5 +1,5 @@
//
-// Copyright 2023 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
@@ -10,7 +10,7 @@
#include <string.h>
-#include <nuts.h>
+#include "nuts.h"
static void
cb_done(void *p)
@@ -148,7 +148,7 @@ test_consumer_cancel(void)
NUTS_TRUE(nng_aio_alloc(&a, cb_done, &done) == 0);
nng_aio_set_timeout(a, NNG_DURATION_INFINITE);
- nng_recv_aio(s1, a);
+ nng_socket_recv(s1, a);
nng_aio_cancel(a);
nng_aio_wait(a);
NUTS_TRUE(done == 1);
@@ -185,10 +185,10 @@ test_traffic(void)
NUTS_PASS(nng_msg_alloc(&m, 0));
NUTS_PASS(nng_msg_append(m, "hello", strlen("hello")));
- nng_recv_aio(s2, rx_aio);
+ nng_socket_recv(s2, rx_aio);
nng_aio_set_msg(tx_aio, m);
- nng_send_aio(s1, tx_aio);
+ nng_socket_send(s1, tx_aio);
nng_aio_wait(tx_aio);
nng_aio_wait(rx_aio);
@@ -221,7 +221,7 @@ test_explicit_timeout(void)
NUTS_PASS(nng_pair1_open(&s));
NUTS_PASS(nng_aio_alloc(&a, cb_done, &done));
nng_aio_set_timeout(a, 40);
- nng_recv_aio(s, a);
+ nng_socket_recv(s, a);
nng_aio_wait(a);
NUTS_TRUE(done == 1);
NUTS_FAIL(nng_aio_result(a), NNG_ETIMEDOUT);
@@ -242,7 +242,7 @@ test_explicit_expiration(void)
now = nng_clock();
now += 40;
nng_aio_set_expire(a, now);
- nng_recv_aio(s, a);
+ nng_socket_recv(s, a);
nng_aio_wait(a);
NUTS_TRUE(done == 1);
NUTS_FAIL(nng_aio_result(a), NNG_ETIMEDOUT);
@@ -260,7 +260,7 @@ test_inherited_timeout(void)
NUTS_PASS(nng_pair1_open(&s));
NUTS_PASS(nng_aio_alloc(&a, cb_done, &done));
NUTS_PASS(nng_socket_set_ms(s, NNG_OPT_RECVTIMEO, 40));
- nng_recv_aio(s, a);
+ nng_socket_recv(s, a);
nng_aio_wait(a);
NUTS_TRUE(done == 1);
NUTS_FAIL(nng_aio_result(a), NNG_ETIMEDOUT);
@@ -278,7 +278,7 @@ test_zero_timeout(void)
NUTS_PASS(nng_pair1_open(&s));
NUTS_PASS(nng_aio_alloc(&a, cb_done, &done));
nng_aio_set_timeout(a, NNG_DURATION_ZERO);
- nng_recv_aio(s, a);
+ nng_socket_recv(s, a);
nng_aio_wait(a);
NUTS_TRUE(done == 1);
NUTS_FAIL(nng_aio_result(a), NNG_ETIMEDOUT);
diff --git a/src/nng.c b/src/nng.c
index 77d16b9e..d51d781c 100644
--- a/src/nng.c
+++ b/src/nng.c
@@ -180,7 +180,7 @@ nng_sendmsg(nng_socket s, nng_msg *msg, int flags)
}
void
-nng_recv_aio(nng_socket s, nng_aio *aio)
+nng_socket_recv(nng_socket s, nng_aio *aio)
{
nni_sock *sock;
int rv;
@@ -195,7 +195,7 @@ nng_recv_aio(nng_socket s, nng_aio *aio)
}
void
-nng_send_aio(nng_socket s, nng_aio *aio)
+nng_socket_send(nng_socket s, nng_aio *aio)
{
nni_sock *sock;
int rv;
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. <info@staysail.tech>
+// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2017 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
@@ -9,7 +9,7 @@
//
#include "nng/nng.h"
-#include <nuts.h>
+#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. <info@staysail.tech>
+// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
@@ -12,9 +12,9 @@
#include <string.h>
#include <time.h>
-#include <nng/nng.h>
+#include "nng/nng.h"
-#include <nuts.h>
+#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.