aboutsummaryrefslogtreecommitdiff
path: root/src/sp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sp')
-rw-r--r--src/sp/protocol/bus0/bus.c22
-rw-r--r--src/sp/protocol/pair0/pair.c20
-rw-r--r--src/sp/protocol/pair1/pair.c33
-rw-r--r--src/sp/protocol/pair1/pair1_poly.c11
-rw-r--r--src/sp/protocol/pipeline0/pull.c2
-rw-r--r--src/sp/protocol/pipeline0/push.c10
-rw-r--r--src/sp/protocol/pubsub0/pub.c10
-rw-r--r--src/sp/protocol/pubsub0/sub.c40
-rw-r--r--src/sp/protocol/reqrep0/rep.c13
-rw-r--r--src/sp/protocol/reqrep0/req.c31
-rw-r--r--src/sp/protocol/reqrep0/xrep.c9
-rw-r--r--src/sp/protocol/reqrep0/xreq.c9
-rw-r--r--src/sp/protocol/survey0/respond.c13
-rw-r--r--src/sp/protocol/survey0/survey.c20
-rw-r--r--src/sp/protocol/survey0/xrespond.c9
-rw-r--r--src/sp/protocol/survey0/xsurvey.c9
-rw-r--r--src/sp/transport.h2
-rw-r--r--src/sp/transport/inproc/inproc.c14
-rw-r--r--src/sp/transport/ipc/ipc.c12
-rw-r--r--src/sp/transport/socket/sockfd.c10
-rw-r--r--src/sp/transport/tcp/tcp.c10
-rw-r--r--src/sp/transport/tls/tls.c10
-rw-r--r--src/sp/transport/udp/udp.c38
23 files changed, 183 insertions, 174 deletions
diff --git a/src/sp/protocol/bus0/bus.c b/src/sp/protocol/bus0/bus.c
index 13abfd6b..4f946365 100644
--- a/src/sp/protocol/bus0/bus.c
+++ b/src/sp/protocol/bus0/bus.c
@@ -360,7 +360,7 @@ again:
nni_aio_finish(aio, 0, nni_msg_len(msg));
}
-static int
+static nng_err
bus0_sock_get_send_fd(void *arg, int *fdp)
{
bus0_sock *sock = arg;
@@ -369,7 +369,7 @@ bus0_sock_get_send_fd(void *arg, int *fdp)
return (nni_pollable_getfd(&sock->can_send, fdp));
}
-static int
+static nng_err
bus0_sock_get_recv_fd(void *arg, int *fdp)
{
bus0_sock *s = arg;
@@ -377,7 +377,7 @@ bus0_sock_get_recv_fd(void *arg, int *fdp)
return (nni_pollable_getfd(&s->can_recv, fdp));
}
-static int
+static nng_err
bus0_sock_get_recv_buf_len(void *arg, void *buf, size_t *szp, nni_type t)
{
bus0_sock *s = arg;
@@ -389,7 +389,7 @@ bus0_sock_get_recv_buf_len(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_int(val, buf, szp, t));
}
-static int
+static nng_err
bus0_sock_get_send_buf_len(void *arg, void *buf, size_t *szp, nni_type t)
{
bus0_sock *s = arg;
@@ -400,14 +400,14 @@ bus0_sock_get_send_buf_len(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_int(val, buf, szp, t));
}
-static int
+static nng_err
bus0_sock_set_recv_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
{
bus0_sock *s = arg;
int val;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&val, buf, sz, 1, 8192, t)) != 0) {
+ if ((rv = nni_copyin_int(&val, buf, sz, 1, 8192, t)) != NNG_OK) {
return (rv);
}
nni_mtx_lock(&s->mtx);
@@ -417,18 +417,18 @@ bus0_sock_set_recv_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
}
nni_mtx_unlock(&s->mtx);
- return (0);
+ return (NNG_OK);
}
-static int
+static nng_err
bus0_sock_set_send_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
{
bus0_sock *s = arg;
bus0_pipe *p;
int val;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&val, buf, sz, 1, 8192, t)) != 0) {
+ if ((rv = nni_copyin_int(&val, buf, sz, 1, 8192, t)) != NNG_OK) {
return (rv);
}
diff --git a/src/sp/protocol/pair0/pair.c b/src/sp/protocol/pair0/pair.c
index 5dc7f67a..89bff7ce 100644
--- a/src/sp/protocol/pair0/pair.c
+++ b/src/sp/protocol/pair0/pair.c
@@ -430,14 +430,14 @@ pair0_sock_recv(void *arg, nni_aio *aio)
nni_mtx_unlock(&s->mtx);
}
-static int
+static nng_err
pair0_set_send_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
{
pair0_sock *s = arg;
int val;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&val, buf, sz, 0, 8192, t)) != 0) {
+ if ((rv = nni_copyin_int(&val, buf, sz, 0, 8192, t)) != NNG_OK) {
return (rv);
}
nni_mtx_lock(&s->mtx);
@@ -452,7 +452,7 @@ pair0_set_send_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
return (rv);
}
-static int
+static nng_err
pair0_get_send_buf_len(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
pair0_sock *s = arg;
@@ -465,14 +465,14 @@ pair0_get_send_buf_len(void *arg, void *buf, size_t *szp, nni_opt_type t)
return (nni_copyout_int(val, buf, szp, t));
}
-static int
+static nng_err
pair0_set_recv_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
{
pair0_sock *s = arg;
int val;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&val, buf, sz, 0, 8192, t)) != 0) {
+ if ((rv = nni_copyin_int(&val, buf, sz, 0, 8192, t)) != NNG_OK) {
return (rv);
}
nni_mtx_lock(&s->mtx);
@@ -487,7 +487,7 @@ pair0_set_recv_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
return (rv);
}
-static int
+static nng_err
pair0_get_recv_buf_len(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
pair0_sock *s = arg;
@@ -500,7 +500,7 @@ pair0_get_recv_buf_len(void *arg, void *buf, size_t *szp, nni_opt_type t)
return (nni_copyout_int(val, buf, szp, t));
}
-static int
+static nng_err
pair0_sock_get_recv_fd(void *arg, int *fdp)
{
pair0_sock *s = arg;
@@ -508,7 +508,7 @@ pair0_sock_get_recv_fd(void *arg, int *fdp)
return (nni_pollable_getfd(&s->readable, fdp));
}
-static int
+static nng_err
pair0_sock_get_send_fd(void *arg, int *fdp)
{
pair0_sock *s = arg;
diff --git a/src/sp/protocol/pair1/pair.c b/src/sp/protocol/pair1/pair.c
index 35e87b7b..3aa9b4c7 100644
--- a/src/sp/protocol/pair1/pair.c
+++ b/src/sp/protocol/pair1/pair.c
@@ -467,21 +467,22 @@ pair1_sock_close(void *arg)
nni_mtx_unlock(&s->mtx);
}
-static int
+static nng_err
pair1_sock_set_max_ttl(void *arg, const void *buf, size_t sz, nni_opt_type t)
{
pair1_sock *s = arg;
- int rv;
+ nng_err rv;
int ttl;
- if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) == 0) {
+ if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) ==
+ NNG_OK) {
nni_atomic_set(&s->ttl, ttl);
}
return (rv);
}
-static int
+static nng_err
pair1_sock_get_max_ttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
pair1_sock *s = arg;
@@ -489,11 +490,11 @@ pair1_sock_get_max_ttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
}
#ifdef NNG_TEST_LIB
-static int
+static nng_err
pair1_set_test_inject_header(void *arg, const void *buf, size_t sz, nni_type t)
{
pair1_sock *s = arg;
- int rv;
+ nng_err rv;
nni_mtx_lock(&s->mtx);
rv = nni_copyin_bool(&s->inject_header, buf, sz, t);
nni_mtx_unlock(&s->mtx);
@@ -646,14 +647,14 @@ pair1_sock_recv(void *arg, nni_aio *aio)
nni_mtx_unlock(&s->mtx);
}
-static int
+static nng_err
pair1_set_send_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
{
pair1_sock *s = arg;
int val;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&val, buf, sz, 0, 8192, t)) != 0) {
+ if ((rv = nni_copyin_int(&val, buf, sz, 0, 8192, t)) != NNG_OK) {
return (rv);
}
nni_mtx_lock(&s->mtx);
@@ -668,7 +669,7 @@ pair1_set_send_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
return (rv);
}
-static int
+static nng_err
pair1_get_send_buf_len(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
pair1_sock *s = arg;
@@ -681,14 +682,14 @@ pair1_get_send_buf_len(void *arg, void *buf, size_t *szp, nni_opt_type t)
return (nni_copyout_int(val, buf, szp, t));
}
-static int
+static nng_err
pair1_set_recv_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
{
pair1_sock *s = arg;
int val;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&val, buf, sz, 0, 8192, t)) != 0) {
+ if ((rv = nni_copyin_int(&val, buf, sz, 0, 8192, t)) != NNG_OK) {
return (rv);
}
nni_mtx_lock(&s->mtx);
@@ -703,7 +704,7 @@ pair1_set_recv_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
return (rv);
}
-static int
+static nng_err
pair1_get_recv_buf_len(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
pair1_sock *s = arg;
@@ -716,7 +717,7 @@ pair1_get_recv_buf_len(void *arg, void *buf, size_t *szp, nni_opt_type t)
return (nni_copyout_int(val, buf, szp, t));
}
-static int
+static nng_err
pair1_sock_get_recv_fd(void *arg, int *fdp)
{
pair1_sock *s = arg;
@@ -724,7 +725,7 @@ pair1_sock_get_recv_fd(void *arg, int *fdp)
return (nni_pollable_getfd(&s->readable, fdp));
}
-static int
+static nng_err
pair1_sock_get_send_fd(void *arg, int *fdp)
{
pair1_sock *s = arg;
diff --git a/src/sp/protocol/pair1/pair1_poly.c b/src/sp/protocol/pair1/pair1_poly.c
index 0e8a93f3..af3ede3b 100644
--- a/src/sp/protocol/pair1/pair1_poly.c
+++ b/src/sp/protocol/pair1/pair1_poly.c
@@ -443,28 +443,29 @@ pair1poly_sock_close(void *arg)
nni_aio_close(&s->aio_get);
}
-static int
+static nng_err
pair1poly_set_max_ttl(void *arg, const void *buf, size_t sz, nni_opt_type t)
{
pair1poly_sock *s = arg;
- int rv;
+ nng_err rv;
int ttl;
- if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) == 0) {
+ if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) ==
+ NNG_OK) {
nni_atomic_set(&s->ttl, ttl);
}
return (rv);
}
-static int
+static nng_err
pair1poly_get_max_ttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
pair1poly_sock *s = arg;
return (nni_copyout_int(nni_atomic_get(&s->ttl), buf, szp, t));
}
-static int
+static nng_err
pair1poly_get_poly(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
NNI_ARG_UNUSED(arg);
diff --git a/src/sp/protocol/pipeline0/pull.c b/src/sp/protocol/pipeline0/pull.c
index d808180a..559935b0 100644
--- a/src/sp/protocol/pipeline0/pull.c
+++ b/src/sp/protocol/pipeline0/pull.c
@@ -245,7 +245,7 @@ pull0_sock_recv(void *arg, nni_aio *aio)
nni_mtx_unlock(&s->m);
}
-static int
+static nng_err
pull0_sock_get_recv_fd(void *arg, int *fdp)
{
pull0_sock *s = arg;
diff --git a/src/sp/protocol/pipeline0/push.c b/src/sp/protocol/pipeline0/push.c
index 4260f333..cd710480 100644
--- a/src/sp/protocol/pipeline0/push.c
+++ b/src/sp/protocol/pipeline0/push.c
@@ -321,14 +321,14 @@ push0_sock_recv(void *arg, nni_aio *aio)
nni_aio_finish_error(aio, NNG_ENOTSUP);
}
-static int
+static nng_err
push0_set_send_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
{
push0_sock *s = arg;
int val;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&val, buf, sz, 0, 8192, t)) != 0) {
+ if ((rv = nni_copyin_int(&val, buf, sz, 0, 8192, t)) != NNG_OK) {
return (rv);
}
nni_mtx_lock(&s->m);
@@ -343,7 +343,7 @@ push0_set_send_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
return (rv);
}
-static int
+static nng_err
push0_get_send_buf_len(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
push0_sock *s = arg;
@@ -356,7 +356,7 @@ push0_get_send_buf_len(void *arg, void *buf, size_t *szp, nni_opt_type t)
return (nni_copyout_int(val, buf, szp, t));
}
-static int
+static nng_err
push0_sock_get_send_fd(void *arg, int *fdp)
{
push0_sock *s = arg;
diff --git a/src/sp/protocol/pubsub0/pub.c b/src/sp/protocol/pubsub0/pub.c
index db449cde..5104162b 100644
--- a/src/sp/protocol/pubsub0/pub.c
+++ b/src/sp/protocol/pubsub0/pub.c
@@ -249,7 +249,7 @@ pub0_sock_send(void *arg, nni_aio *aio)
nni_aio_finish(aio, 0, len);
}
-static int
+static nng_err
pub0_sock_get_sendfd(void *arg, int *fdp)
{
pub0_sock *sock = arg;
@@ -259,15 +259,15 @@ pub0_sock_get_sendfd(void *arg, int *fdp)
return (nni_pollable_getfd(&sock->sendable, fdp));
}
-static int
+static nng_err
pub0_sock_set_sendbuf(void *arg, const void *buf, size_t sz, nni_type t)
{
pub0_sock *sock = arg;
pub0_pipe *p;
int val;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&val, buf, sz, 1, 8192, t)) != 0) {
+ if ((rv = nni_copyin_int(&val, buf, sz, 1, 8192, t)) != NNG_OK) {
return (rv);
}
@@ -287,7 +287,7 @@ pub0_sock_set_sendbuf(void *arg, const void *buf, size_t sz, nni_type t)
return (rv);
}
-static int
+static nng_err
pub0_sock_get_sendbuf(void *arg, void *buf, size_t *szp, nni_type t)
{
pub0_sock *sock = arg;
diff --git a/src/sp/protocol/pubsub0/sub.c b/src/sp/protocol/pubsub0/sub.c
index 6744e909..c426d46c 100644
--- a/src/sp/protocol/pubsub0/sub.c
+++ b/src/sp/protocol/pubsub0/sub.c
@@ -400,7 +400,7 @@ sub0_recv_cb(void *arg)
nni_pipe_recv(p->pipe, &p->aio_recv);
}
-static int
+static nng_err
sub0_ctx_get_recv_buf_len(void *arg, void *buf, size_t *szp, nni_type t)
{
sub0_ctx *ctx = arg;
@@ -413,15 +413,15 @@ sub0_ctx_get_recv_buf_len(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_int(val, buf, szp, t));
}
-static int
+static nng_err
sub0_ctx_set_recv_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
{
sub0_ctx *ctx = arg;
sub0_sock *sock = ctx->sock;
int val;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&val, buf, sz, 1, 8192, t)) != 0) {
+ if ((rv = nni_copyin_int(&val, buf, sz, 1, 8192, t)) != NNG_OK) {
return (rv);
}
nni_mtx_lock(&sock->lk);
@@ -436,7 +436,7 @@ sub0_ctx_set_recv_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
sock->recv_buf_len = (size_t) val;
}
nni_mtx_unlock(&sock->lk);
- return (0);
+ return (NNG_OK);
}
// For now, we maintain subscriptions on a sorted linked list. As we do not
@@ -444,7 +444,7 @@ sub0_ctx_set_recv_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
// really O(n), we think this is acceptable. In the future we might decide
// to replace this with a patricia trie, like old nanomsg had.
-static int
+static nng_err
sub0_ctx_subscribe(sub0_ctx *ctx, const void *buf, size_t sz)
{
sub0_sock *sock = ctx->sock;
@@ -459,7 +459,7 @@ sub0_ctx_subscribe(sub0_ctx *ctx, const void *buf, size_t sz)
if (memcmp(topic->buf, buf, sz) == 0) {
// Already have it.
nni_mtx_unlock(&sock->lk);
- return (0);
+ return (NNG_OK);
}
}
if ((new_topic = NNI_ALLOC_STRUCT(new_topic)) == NULL) {
@@ -477,10 +477,10 @@ sub0_ctx_subscribe(sub0_ctx *ctx, const void *buf, size_t sz)
new_topic->len = sz;
nni_list_append(&ctx->topics, new_topic);
nni_mtx_unlock(&sock->lk);
- return (0);
+ return (NNG_OK);
}
-static int
+static nng_err
sub0_ctx_unsubscribe(sub0_ctx *ctx, const void *buf, size_t sz)
{
sub0_sock *sock = ctx->sock;
@@ -521,10 +521,10 @@ sub0_ctx_unsubscribe(sub0_ctx *ctx, const void *buf, size_t sz)
nni_free(topic->buf, topic->len);
NNI_FREE_STRUCT(topic);
- return (0);
+ return (NNG_OK);
}
-static int
+static nng_err
sub0_ctx_get_prefer_new(void *arg, void *buf, size_t *szp, nni_type t)
{
sub0_ctx *ctx = arg;
@@ -538,15 +538,15 @@ sub0_ctx_get_prefer_new(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_bool(val, buf, szp, t));
}
-static int
+static nng_err
sub0_ctx_set_prefer_new(void *arg, const void *buf, size_t sz, nni_type t)
{
sub0_ctx *ctx = arg;
sub0_sock *sock = ctx->sock;
bool val;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_bool(&val, buf, sz, t)) != 0) {
+ if ((rv = nni_copyin_bool(&val, buf, sz, t)) != NNG_OK) {
return (rv);
}
@@ -557,7 +557,7 @@ sub0_ctx_set_prefer_new(void *arg, const void *buf, size_t sz, nni_type t)
}
nni_mtx_unlock(&sock->lk);
- return (0);
+ return (NNG_OK);
}
static nni_option sub0_ctx_options[] = {
@@ -591,7 +591,7 @@ sub0_sock_recv(void *arg, nni_aio *aio)
sub0_ctx_recv(&sock->master, aio);
}
-static int
+static nng_err
sub0_sock_get_recv_fd(void *arg, int *fdp)
{
sub0_sock *sock = arg;
@@ -599,28 +599,28 @@ sub0_sock_get_recv_fd(void *arg, int *fdp)
return (nni_pollable_getfd(&sock->readable, fdp));
}
-static int
+static nng_err
sub0_sock_get_recv_buf_len(void *arg, void *buf, size_t *szp, nni_type t)
{
sub0_sock *sock = arg;
return (sub0_ctx_get_recv_buf_len(&sock->master, buf, szp, t));
}
-static int
+static nng_err
sub0_sock_set_recv_buf_len(void *arg, const void *buf, size_t sz, nni_type t)
{
sub0_sock *sock = arg;
return (sub0_ctx_set_recv_buf_len(&sock->master, buf, sz, t));
}
-static int
+static nng_err
sub0_sock_get_prefer_new(void *arg, void *buf, size_t *szp, nni_type t)
{
sub0_sock *sock = arg;
return (sub0_ctx_get_prefer_new(&sock->master, buf, szp, t));
}
-static int
+static nng_err
sub0_sock_set_prefer_new(void *arg, const void *buf, size_t sz, nni_type t)
{
sub0_sock *sock = arg;
diff --git a/src/sp/protocol/reqrep0/rep.c b/src/sp/protocol/reqrep0/rep.c
index e84440a7..6df65df3 100644
--- a/src/sp/protocol/reqrep0/rep.c
+++ b/src/sp/protocol/reqrep0/rep.c
@@ -567,20 +567,21 @@ drop:
nni_pipe_recv(p->pipe, &p->aio_recv);
}
-static int
+static nng_err
rep0_sock_set_max_ttl(void *arg, const void *buf, size_t sz, nni_opt_type t)
{
rep0_sock *s = arg;
int ttl;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) == 0) {
+ if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) ==
+ NNG_OK) {
nni_atomic_set(&s->ttl, ttl);
}
return (rv);
}
-static int
+static nng_err
rep0_sock_get_max_ttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
rep0_sock *s = arg;
@@ -588,7 +589,7 @@ rep0_sock_get_max_ttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
return (nni_copyout_int(nni_atomic_get(&s->ttl), buf, szp, t));
}
-static int
+static nng_err
rep0_sock_get_sendfd(void *arg, int *fdp)
{
rep0_sock *s = arg;
@@ -596,7 +597,7 @@ rep0_sock_get_sendfd(void *arg, int *fdp)
return (nni_pollable_getfd(&s->writable, fdp));
}
-static int
+static nng_err
rep0_sock_get_recvfd(void *arg, int *fdp)
{
rep0_sock *s = arg;
diff --git a/src/sp/protocol/reqrep0/req.c b/src/sp/protocol/reqrep0/req.c
index 52f97d3a..85c2dfa4 100644
--- a/src/sp/protocol/reqrep0/req.c
+++ b/src/sp/protocol/reqrep0/req.c
@@ -465,14 +465,14 @@ req0_ctx_fini(void *arg)
nni_mtx_unlock(&s->mtx);
}
-static int
+static nng_err
req0_ctx_set_resend_time(void *arg, const void *buf, size_t sz, nni_opt_type t)
{
req0_ctx *ctx = arg;
return (nni_copyin_ms(&ctx->retry, buf, sz, t));
}
-static int
+static nng_err
req0_ctx_get_resend_time(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
req0_ctx *ctx = arg;
@@ -777,52 +777,53 @@ req0_sock_recv(void *arg, nni_aio *aio)
req0_ctx_recv(&s->master, aio);
}
-static int
+static nng_err
req0_sock_set_max_ttl(void *arg, const void *buf, size_t sz, nni_opt_type t)
{
req0_sock *s = arg;
int ttl;
- int rv;
- if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) ==
+ NNG_OK) {
nni_atomic_set(&s->ttl, ttl);
}
return (rv);
}
-static int
+static nng_err
req0_sock_get_max_ttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
req0_sock *s = arg;
return (nni_copyout_int(nni_atomic_get(&s->ttl), buf, szp, t));
}
-static int
+static nng_err
req0_sock_set_resend_time(
void *arg, const void *buf, size_t sz, nni_opt_type t)
{
req0_sock *s = arg;
- int rv;
+ nng_err rv;
rv = req0_ctx_set_resend_time(&s->master, buf, sz, t);
s->retry = s->master.retry;
return (rv);
}
-static int
+static nng_err
req0_sock_get_resend_time(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
req0_sock *s = arg;
return (req0_ctx_get_resend_time(&s->master, buf, szp, t));
}
-static int
+static nng_err
req0_sock_set_resend_tick(
void *arg, const void *buf, size_t sz, nni_opt_type t)
{
req0_sock *s = arg;
nng_duration tick;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_ms(&tick, buf, sz, t)) == 0) {
+ if ((rv = nni_copyin_ms(&tick, buf, sz, t)) == NNG_OK) {
nni_mtx_lock(&s->mtx);
s->retry_tick = tick;
nni_mtx_unlock(&s->mtx);
@@ -830,7 +831,7 @@ req0_sock_set_resend_tick(
return (rv);
}
-static int
+static nng_err
req0_sock_get_resend_tick(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
req0_sock *s = arg;
@@ -842,7 +843,7 @@ req0_sock_get_resend_tick(void *arg, void *buf, size_t *szp, nni_opt_type t)
return (nni_copyout_ms(tick, buf, szp, t));
}
-static int
+static nng_err
req0_sock_get_send_fd(void *arg, int *fdp)
{
req0_sock *s = arg;
@@ -850,7 +851,7 @@ req0_sock_get_send_fd(void *arg, int *fdp)
return (nni_pollable_getfd(&s->writable, fdp));
}
-static int
+static nng_err
req0_sock_get_recv_fd(void *arg, int *fdp)
{
req0_sock *s = arg;
diff --git a/src/sp/protocol/reqrep0/xrep.c b/src/sp/protocol/reqrep0/xrep.c
index 1a5f6e24..fe6c9fde 100644
--- a/src/sp/protocol/reqrep0/xrep.c
+++ b/src/sp/protocol/reqrep0/xrep.c
@@ -353,19 +353,20 @@ xrep0_pipe_putq_cb(void *arg)
nni_pipe_recv(p->pipe, &p->aio_recv);
}
-static int
+static nng_err
xrep0_sock_set_maxttl(void *arg, const void *buf, size_t sz, nni_opt_type t)
{
xrep0_sock *s = arg;
int ttl;
- int rv;
- if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) ==
+ NNG_OK) {
nni_atomic_set(&s->ttl, ttl);
}
return (rv);
}
-static int
+static nng_err
xrep0_sock_get_maxttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
xrep0_sock *s = arg;
diff --git a/src/sp/protocol/reqrep0/xreq.c b/src/sp/protocol/reqrep0/xreq.c
index 2bf3b95e..f80391dd 100644
--- a/src/sp/protocol/reqrep0/xreq.c
+++ b/src/sp/protocol/reqrep0/xreq.c
@@ -256,19 +256,20 @@ xreq0_sock_recv(void *arg, nni_aio *aio)
nni_msgq_aio_get(s->urq, aio);
}
-static int
+static nng_err
xreq0_sock_set_max_ttl(void *arg, const void *buf, size_t sz, nni_opt_type t)
{
xreq0_sock *s = arg;
int ttl;
- int rv;
- if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) ==
+ NNG_OK) {
nni_atomic_set(&s->ttl, ttl);
}
return (rv);
}
-static int
+static nng_err
xreq0_sock_get_max_ttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
xreq0_sock *s = arg;
diff --git a/src/sp/protocol/survey0/respond.c b/src/sp/protocol/survey0/respond.c
index ace2962a..f50ccb6b 100644
--- a/src/sp/protocol/survey0/respond.c
+++ b/src/sp/protocol/survey0/respond.c
@@ -557,27 +557,28 @@ drop:
nni_pipe_recv(p->npipe, &p->aio_recv);
}
-static int
+static nng_err
resp0_sock_set_max_ttl(void *arg, const void *buf, size_t sz, nni_opt_type t)
{
resp0_sock *s = arg;
int ttl;
- int rv;
+ nng_err rv;
- if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) == 0) {
+ if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) ==
+ NNG_OK) {
nni_atomic_set(&s->ttl, ttl);
}
return (rv);
}
-static int
+static nng_err
resp0_sock_get_max_ttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
resp0_sock *s = arg;
return (nni_copyout_int(nni_atomic_get(&s->ttl), buf, szp, t));
}
-static int
+static nng_err
resp0_sock_get_sendfd(void *arg, int *fdp)
{
resp0_sock *s = arg;
@@ -585,7 +586,7 @@ resp0_sock_get_sendfd(void *arg, int *fdp)
return (nni_pollable_getfd(&s->writable, fdp));
}
-static int
+static nng_err
resp0_sock_get_recvfd(void *arg, int *fdp)
{
resp0_sock *s = arg;
diff --git a/src/sp/protocol/survey0/survey.c b/src/sp/protocol/survey0/survey.c
index c64f0bb0..716375a9 100644
--- a/src/sp/protocol/survey0/survey.c
+++ b/src/sp/protocol/survey0/survey.c
@@ -462,20 +462,20 @@ surv0_pipe_recv_cb(void *arg)
nni_pipe_recv(p->pipe, &p->aio_recv);
}
-static int
+static nng_err
surv0_ctx_set_survey_time(
void *arg, const void *buf, size_t sz, nni_opt_type t)
{
surv0_ctx *ctx = arg;
nng_duration expire;
- int rv;
- if ((rv = nni_copyin_ms(&expire, buf, sz, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_ms(&expire, buf, sz, t)) == NNG_OK) {
nni_atomic_set(&ctx->survey_time, expire);
}
return (rv);
}
-static int
+static nng_err
surv0_ctx_get_survey_time(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
surv0_ctx *ctx = arg;
@@ -483,21 +483,21 @@ surv0_ctx_get_survey_time(void *arg, void *buf, size_t *szp, nni_opt_type t)
nni_copyout_ms(nni_atomic_get(&ctx->survey_time), buf, szp, t));
}
-static int
+static nng_err
surv0_sock_set_max_ttl(void *arg, const void *buf, size_t sz, nni_opt_type t)
{
surv0_sock *s = arg;
return (nni_copyin_int(&s->ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t));
}
-static int
+static nng_err
surv0_sock_get_max_ttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
surv0_sock *s = arg;
return (nni_copyout_int(s->ttl, buf, szp, t));
}
-static int
+static nng_err
surv0_sock_set_survey_time(
void *arg, const void *buf, size_t sz, nni_opt_type t)
{
@@ -505,14 +505,14 @@ surv0_sock_set_survey_time(
return (surv0_ctx_set_survey_time(&s->ctx, buf, sz, t));
}
-static int
+static nng_err
surv0_sock_get_survey_time(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
surv0_sock *s = arg;
return (surv0_ctx_get_survey_time(&s->ctx, buf, szp, t));
}
-static int
+static nng_err
surv0_sock_get_send_fd(void *arg, int *fdp)
{
surv0_sock *sock = arg;
@@ -520,7 +520,7 @@ surv0_sock_get_send_fd(void *arg, int *fdp)
return (nni_pollable_getfd(&sock->writable, fdp));
}
-static int
+static nng_err
surv0_sock_get_recv_fd(void *arg, int *fdp)
{
surv0_sock *sock = arg;
diff --git a/src/sp/protocol/survey0/xrespond.c b/src/sp/protocol/survey0/xrespond.c
index ceddc118..0e04b516 100644
--- a/src/sp/protocol/survey0/xrespond.c
+++ b/src/sp/protocol/survey0/xrespond.c
@@ -334,19 +334,20 @@ xresp0_putq_cb(void *arg)
nni_pipe_recv(p->npipe, &p->aio_recv);
}
-static int
+static nng_err
xresp0_sock_set_maxttl(void *arg, const void *buf, size_t sz, nni_opt_type t)
{
xresp0_sock *s = arg;
int ttl;
- int rv;
- if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) ==
+ NNG_OK) {
nni_atomic_set(&s->ttl, ttl);
}
return (rv);
}
-static int
+static nng_err
xresp0_sock_get_maxttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
xresp0_sock *s = arg;
diff --git a/src/sp/protocol/survey0/xsurvey.c b/src/sp/protocol/survey0/xsurvey.c
index 2891fba5..3c78c392 100644
--- a/src/sp/protocol/survey0/xsurvey.c
+++ b/src/sp/protocol/survey0/xsurvey.c
@@ -272,19 +272,20 @@ xsurv0_recv_cb(void *arg)
nni_msgq_aio_put(p->psock->urq, &p->aio_putq);
}
-static int
+static nng_err
xsurv0_sock_set_max_ttl(void *arg, const void *buf, size_t sz, nni_opt_type t)
{
xsurv0_sock *s = arg;
int ttl;
- int rv;
- if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_int(&ttl, buf, sz, 1, NNI_MAX_MAX_TTL, t)) ==
+ NNG_OK) {
nni_atomic_set(&s->ttl, ttl);
}
return (rv);
}
-static int
+static nng_err
xsurv0_sock_get_max_ttl(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
xsurv0_sock *s = arg;
diff --git a/src/sp/transport.h b/src/sp/transport.h
index 733388e8..e4e3e156 100644
--- a/src/sp/transport.h
+++ b/src/sp/transport.h
@@ -120,7 +120,7 @@ struct nni_sp_listener_ops {
int (*l_set_tls)(void *, nng_tls_config *);
// l_set_security_descriptor is used exclusively on Windows.
- int (*l_set_security_descriptor)(void *, void *);
+ nng_err (*l_set_security_descriptor)(void *, void *);
// l_options is an array of listener options. The final
// element must have a NULL name. If this member is NULL, then
diff --git a/src/sp/transport/inproc/inproc.c b/src/sp/transport/inproc/inproc.c
index 8c662ca3..95500932 100644
--- a/src/sp/transport/inproc/inproc.c
+++ b/src/sp/transport/inproc/inproc.c
@@ -247,7 +247,7 @@ inproc_pipe_peer(void *arg)
return (pipe->peer);
}
-static int
+static nng_err
inproc_pipe_get_addr(void *arg, void *buf, size_t *szp, nni_opt_type t)
{
inproc_pipe *p = arg;
@@ -526,24 +526,24 @@ inproc_ep_accept(void *arg, nni_aio *aio)
nni_mtx_unlock(&nni_inproc.mx);
}
-static int
+static nng_err
inproc_ep_get_recvmaxsz(void *arg, void *v, size_t *szp, nni_opt_type t)
{
inproc_ep *ep = arg;
- int rv;
+ nng_err rv;
nni_mtx_lock(&ep->mtx);
rv = nni_copyout_size(ep->rcvmax, v, szp, t);
nni_mtx_unlock(&ep->mtx);
return (rv);
}
-static int
+static nng_err
inproc_ep_set_recvmaxsz(void *arg, const void *v, size_t sz, nni_opt_type t)
{
inproc_ep *ep = arg;
size_t val;
- int rv;
- if ((rv = nni_copyin_size(&val, v, sz, 0, NNI_MAXSZ, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_size(&val, v, sz, 0, NNI_MAXSZ, t)) == NNG_OK) {
nni_mtx_lock(&ep->mtx);
ep->rcvmax = val;
nni_mtx_unlock(&ep->mtx);
@@ -551,7 +551,7 @@ inproc_ep_set_recvmaxsz(void *arg, const void *v, size_t sz, nni_opt_type t)
return (rv);
}
-static int
+static nng_err
inproc_ep_get_addr(void *arg, void *v, size_t *szp, nni_opt_type t)
{
inproc_ep *ep = arg;
diff --git a/src/sp/transport/ipc/ipc.c b/src/sp/transport/ipc/ipc.c
index 0163767b..35d4cc97 100644
--- a/src/sp/transport/ipc/ipc.c
+++ b/src/sp/transport/ipc/ipc.c
@@ -873,24 +873,24 @@ ipc_ep_connect(void *arg, nni_aio *aio)
nni_mtx_unlock(&ep->mtx);
}
-static int
+static nng_err
ipc_ep_get_recv_max_sz(void *arg, void *v, size_t *szp, nni_type t)
{
ipc_ep *ep = arg;
- int rv;
+ nng_err rv;
nni_mtx_lock(&ep->mtx);
rv = nni_copyout_size(ep->rcv_max, v, szp, t);
nni_mtx_unlock(&ep->mtx);
return (rv);
}
-static int
+static nng_err
ipc_ep_set_recv_max_sz(void *arg, const void *v, size_t sz, nni_type t)
{
ipc_ep *ep = arg;
size_t val;
- int rv;
- if ((rv = nni_copyin_size(&val, v, sz, 0, NNI_MAXSZ, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_size(&val, v, sz, 0, NNI_MAXSZ, t)) == NNG_OK) {
nni_mtx_lock(&ep->mtx);
ep->rcv_max = val;
@@ -1034,7 +1034,7 @@ ipc_listener_set(
return (rv);
}
-static int
+static nng_err
ipc_listener_set_sec_desc(void *arg, void *pdesc)
{
ipc_ep *ep = arg;
diff --git a/src/sp/transport/socket/sockfd.c b/src/sp/transport/socket/sockfd.c
index e7b25d8b..c50360af 100644
--- a/src/sp/transport/socket/sockfd.c
+++ b/src/sp/transport/socket/sockfd.c
@@ -739,11 +739,11 @@ sfd_tran_ep_cancel(nni_aio *aio, void *arg, nng_err rv)
nni_mtx_unlock(&ep->mtx);
}
-static int
+static nng_err
sfd_tran_ep_get_recvmaxsz(void *arg, void *v, size_t *szp, nni_opt_type t)
{
sfd_tran_ep *ep = arg;
- int rv;
+ nng_err rv;
nni_mtx_lock(&ep->mtx);
rv = nni_copyout_size(ep->rcvmax, v, szp, t);
@@ -751,13 +751,13 @@ sfd_tran_ep_get_recvmaxsz(void *arg, void *v, size_t *szp, nni_opt_type t)
return (rv);
}
-static int
+static nng_err
sfd_tran_ep_set_recvmaxsz(void *arg, const void *v, size_t sz, nni_opt_type t)
{
sfd_tran_ep *ep = arg;
size_t val;
- int rv;
- if ((rv = nni_copyin_size(&val, v, sz, 0, NNI_MAXSZ, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_size(&val, v, sz, 0, NNI_MAXSZ, t)) == NNG_OK) {
nni_mtx_lock(&ep->mtx);
ep->rcvmax = val;
nni_mtx_unlock(&ep->mtx);
diff --git a/src/sp/transport/tcp/tcp.c b/src/sp/transport/tcp/tcp.c
index 6bcbca9e..897d8ed6 100644
--- a/src/sp/transport/tcp/tcp.c
+++ b/src/sp/transport/tcp/tcp.c
@@ -884,11 +884,11 @@ tcptran_ep_connect(void *arg, nni_aio *aio)
nni_mtx_unlock(&ep->mtx);
}
-static int
+static nng_err
tcptran_ep_get_recvmaxsz(void *arg, void *v, size_t *szp, nni_opt_type t)
{
tcptran_ep *ep = arg;
- int rv;
+ nng_err rv;
nni_mtx_lock(&ep->mtx);
rv = nni_copyout_size(ep->rcvmax, v, szp, t);
@@ -896,13 +896,13 @@ tcptran_ep_get_recvmaxsz(void *arg, void *v, size_t *szp, nni_opt_type t)
return (rv);
}
-static int
+static nng_err
tcptran_ep_set_recvmaxsz(void *arg, const void *v, size_t sz, nni_opt_type t)
{
tcptran_ep *ep = arg;
size_t val;
- int rv;
- if ((rv = nni_copyin_size(&val, v, sz, 0, NNI_MAXSZ, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_size(&val, v, sz, 0, NNI_MAXSZ, t)) == NNG_OK) {
nni_mtx_lock(&ep->mtx);
ep->rcvmax = val;
nni_mtx_unlock(&ep->mtx);
diff --git a/src/sp/transport/tls/tls.c b/src/sp/transport/tls/tls.c
index 5d2e6d9e..78e8ef35 100644
--- a/src/sp/transport/tls/tls.c
+++ b/src/sp/transport/tls/tls.c
@@ -903,13 +903,13 @@ tlstran_ep_accept(void *arg, nni_aio *aio)
nni_mtx_unlock(&ep->mtx);
}
-static int
+static nng_err
tlstran_ep_set_recvmaxsz(void *arg, const void *v, size_t sz, nni_type t)
{
tlstran_ep *ep = arg;
size_t val;
- int rv;
- if ((rv = nni_copyin_size(&val, v, sz, 0, NNI_MAXSZ, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_size(&val, v, sz, 0, NNI_MAXSZ, t)) == NNG_OK) {
nni_mtx_lock(&ep->mtx);
ep->rcvmax = val;
nni_mtx_unlock(&ep->mtx);
@@ -920,11 +920,11 @@ tlstran_ep_set_recvmaxsz(void *arg, const void *v, size_t sz, nni_type t)
return (rv);
}
-static int
+static nng_err
tlstran_ep_get_recvmaxsz(void *arg, void *v, size_t *szp, nni_type t)
{
tlstran_ep *ep = arg;
- int rv;
+ nng_err rv;
nni_mtx_lock(&ep->mtx);
rv = nni_copyout_size(ep->rcvmax, v, szp, t);
nni_mtx_unlock(&ep->mtx);
diff --git a/src/sp/transport/udp/udp.c b/src/sp/transport/udp/udp.c
index 43fbabe1..fd13461b 100644
--- a/src/sp/transport/udp/udp.c
+++ b/src/sp/transport/udp/udp.c
@@ -1044,24 +1044,24 @@ udp_pipe_peer(void *arg)
return (p->peer);
}
-static int
+static nng_err
udp_pipe_get_recvmax(void *arg, void *v, size_t *szp, nni_type t)
{
udp_pipe *p = arg;
udp_ep *ep = p->ep;
- int rv;
+ nng_err rv;
nni_mtx_lock(&ep->mtx);
rv = nni_copyout_size(p->rcvmax, v, szp, t);
nni_mtx_unlock(&ep->mtx);
return (rv);
}
-static int
+static nng_err
udp_pipe_get_remaddr(void *arg, void *v, size_t *szp, nni_type t)
{
udp_pipe *p = arg;
udp_ep *ep = p->ep;
- int rv;
+ nng_err rv;
nni_mtx_lock(&ep->mtx);
rv = nni_copyout_sockaddr(&p->peer_addr, v, szp, t);
nni_mtx_unlock(&ep->mtx);
@@ -1549,7 +1549,7 @@ udp_ep_connect(void *arg, nni_aio *aio)
nni_mtx_unlock(&ep->mtx);
}
-static int
+static nng_err
udp_ep_get_port(void *arg, void *buf, size_t *szp, nni_type t)
{
udp_ep *ep = arg;
@@ -1586,11 +1586,11 @@ udp_ep_get_port(void *arg, void *buf, size_t *szp, nni_type t)
return (nni_copyout_int(port, buf, szp, t));
}
-static int
+static nng_err
udp_ep_get_locaddr(void *arg, void *v, size_t *szp, nni_opt_type t)
{
udp_ep *ep = arg;
- int rv;
+ nng_err rv;
nng_sockaddr sa;
if (ep->udp != NULL) {
@@ -1603,11 +1603,11 @@ udp_ep_get_locaddr(void *arg, void *v, size_t *szp, nni_opt_type t)
return (rv);
}
-static int
+static nng_err
udp_ep_get_remaddr(void *arg, void *v, size_t *szp, nni_opt_type t)
{
udp_ep *ep = arg;
- int rv;
+ nng_err rv;
nng_sockaddr sa;
if (!ep->dialer) {
@@ -1619,11 +1619,11 @@ udp_ep_get_remaddr(void *arg, void *v, size_t *szp, nni_opt_type t)
return (rv);
}
-static int
+static nng_err
udp_ep_get_recvmaxsz(void *arg, void *v, size_t *szp, nni_opt_type t)
{
udp_ep *ep = arg;
- int rv;
+ nng_err rv;
nni_mtx_lock(&ep->mtx);
rv = nni_copyout_size(ep->rcvmax, v, szp, t);
@@ -1631,13 +1631,13 @@ udp_ep_get_recvmaxsz(void *arg, void *v, size_t *szp, nni_opt_type t)
return (rv);
}
-static int
+static nng_err
udp_ep_set_recvmaxsz(void *arg, const void *v, size_t sz, nni_opt_type t)
{
udp_ep *ep = arg;
size_t val;
- int rv;
- if ((rv = nni_copyin_size(&val, v, sz, 0, 65000, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_size(&val, v, sz, 0, 65000, t)) == NNG_OK) {
if ((val == 0) || (val > 65000)) {
val = 65000;
}
@@ -1653,11 +1653,11 @@ udp_ep_set_recvmaxsz(void *arg, const void *v, size_t sz, nni_opt_type t)
return (rv);
}
-static int
+static nng_err
udp_ep_get_copymax(void *arg, void *v, size_t *szp, nni_opt_type t)
{
udp_ep *ep = arg;
- int rv;
+ nng_err rv;
nni_mtx_lock(&ep->mtx);
rv = nni_copyout_size(ep->copymax, v, szp, t);
@@ -1665,13 +1665,13 @@ udp_ep_get_copymax(void *arg, void *v, size_t *szp, nni_opt_type t)
return (rv);
}
-static int
+static nng_err
udp_ep_set_copymax(void *arg, const void *v, size_t sz, nni_opt_type t)
{
udp_ep *ep = arg;
size_t val;
- int rv;
- if ((rv = nni_copyin_size(&val, v, sz, 0, 65000, t)) == 0) {
+ nng_err rv;
+ if ((rv = nni_copyin_size(&val, v, sz, 0, 65000, t)) == NNG_OK) {
nni_mtx_lock(&ep->mtx);
if (ep->started) {
nni_mtx_unlock(&ep->mtx);