diff options
Diffstat (limited to 'src/sp/protocol/survey0')
| -rw-r--r-- | src/sp/protocol/survey0/respond.c | 13 | ||||
| -rw-r--r-- | src/sp/protocol/survey0/survey.c | 20 | ||||
| -rw-r--r-- | src/sp/protocol/survey0/xrespond.c | 9 | ||||
| -rw-r--r-- | src/sp/protocol/survey0/xsurvey.c | 9 |
4 files changed, 27 insertions, 24 deletions
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; |
