From 7bb5ab9c4f70c9fa0a67a22c4aee83b0109318c4 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 27 Apr 2025 23:35:25 -0700 Subject: Converted property functions to use nng_err. --- src/sp/protocol/reqrep0/req.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'src/sp/protocol/reqrep0/req.c') 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; -- cgit v1.2.3-70-g09d2