diff options
Diffstat (limited to 'src/sp/protocol/reqrep0')
| -rw-r--r-- | src/sp/protocol/reqrep0/rep.c | 13 | ||||
| -rw-r--r-- | src/sp/protocol/reqrep0/req.c | 31 | ||||
| -rw-r--r-- | src/sp/protocol/reqrep0/xrep.c | 9 | ||||
| -rw-r--r-- | src/sp/protocol/reqrep0/xreq.c | 9 |
4 files changed, 33 insertions, 29 deletions
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; |
