diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-06-12 20:05:34 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-06-13 18:01:52 -0700 |
| commit | da2aac4a6eb10af88e3938068e24c58aea1832b1 (patch) | |
| tree | fb0676be5426ed1510945b7e7fe3d09eb45333a7 /src/protocol/reqrep0/xreq.c | |
| parent | 61ffae5e3649897776c26799ccaaa35d578ba816 (diff) | |
| download | nng-da2aac4a6eb10af88e3938068e24c58aea1832b1.tar.gz nng-da2aac4a6eb10af88e3938068e24c58aea1832b1.tar.bz2 nng-da2aac4a6eb10af88e3938068e24c58aea1832b1.zip | |
fixes #540 nni_ep_opttype serves no purpose
fixes #538 setopt should have an explicit chkopt routine
fixes #537 Internal TCP API needs better name separation
fixes #524 Option types should be "typed"
This is a rework of the option management code, to make it both clearer
and to prepare for further work to break up endpoints. This reduces
a certain amount of dead or redundant code, and actually saves cycles
when setting options, as some loops were not terminated that should have
been.
Diffstat (limited to 'src/protocol/reqrep0/xreq.c')
| -rw-r--r-- | src/protocol/reqrep0/xreq.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/protocol/reqrep0/xreq.c b/src/protocol/reqrep0/xreq.c index 793411af..2f0a3652 100644 --- a/src/protocol/reqrep0/xreq.c +++ b/src/protocol/reqrep0/xreq.c @@ -268,17 +268,17 @@ xreq0_sock_recv(void *arg, nni_aio *aio) } static int -xreq0_sock_setopt_maxttl(void *arg, const void *buf, size_t sz, int typ) +xreq0_sock_set_maxttl(void *arg, const void *buf, size_t sz, nni_opt_type t) { xreq0_sock *s = arg; - return (nni_copyin_int(&s->ttl, buf, sz, 1, 255, typ)); + return (nni_copyin_int(&s->ttl, buf, sz, 1, 255, t)); } static int -xreq0_sock_getopt_maxttl(void *arg, void *buf, size_t *szp, int typ) +xreq0_sock_get_maxttl(void *arg, void *buf, size_t *szp, nni_opt_type t) { xreq0_sock *s = arg; - return (nni_copyout_int(s->ttl, buf, szp, typ)); + return (nni_copyout_int(s->ttl, buf, szp, t)); } static nni_proto_pipe_ops xreq0_pipe_ops = { @@ -289,16 +289,16 @@ static nni_proto_pipe_ops xreq0_pipe_ops = { .pipe_stop = xreq0_pipe_stop, }; -static nni_proto_sock_option xreq0_sock_options[] = { +static nni_proto_option xreq0_sock_options[] = { { - .pso_name = NNG_OPT_MAXTTL, - .pso_type = NNI_TYPE_INT32, - .pso_getopt = xreq0_sock_getopt_maxttl, - .pso_setopt = xreq0_sock_setopt_maxttl, + .o_name = NNG_OPT_MAXTTL, + .o_type = NNI_TYPE_INT32, + .o_get = xreq0_sock_get_maxttl, + .o_set = xreq0_sock_set_maxttl, }, // terminate list { - .pso_name = NULL, + .o_name = NULL, }, }; |
