aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/inproc/inproc.c31
-rw-r--r--src/transport/ipc/ipc.c40
-rw-r--r--src/transport/tcp/tcp.c52
-rw-r--r--src/transport/tls/tls.c53
-rw-r--r--src/transport/ws/websocket.c41
-rw-r--r--src/transport/zerotier/zerotier.c89
6 files changed, 51 insertions, 255 deletions
diff --git a/src/transport/inproc/inproc.c b/src/transport/inproc/inproc.c
index a1a2dd5d..84e2c625 100644
--- a/src/transport/inproc/inproc.c
+++ b/src/transport/inproc/inproc.c
@@ -654,36 +654,6 @@ inproc_ep_setopt(
return (nni_setopt(inproc_ep_options, name, arg, v, sz, t));
}
-static int
-inproc_check_recvmaxsz(const void *v, size_t sz, nni_type t)
-{
- return (nni_copyin_size(NULL, v, sz, 0, NNI_MAXSZ, t));
-}
-
-static nni_chkoption inproc_checkopts[] = {
- {
- .o_name = NNG_OPT_RECVMAXSZ,
- .o_check = inproc_check_recvmaxsz,
- },
- {
- .o_name = NNG_OPT_LOCADDR,
- },
- {
- .o_name = NNG_OPT_REMADDR,
- },
- {
- .o_name = NULL,
- },
-};
-
-static int
-inproc_checkopt(const char *name, const void *buf, size_t sz, nni_type t)
-{
- int rv;
- rv = nni_chkopt(inproc_checkopts, name, buf, sz, t);
- return (rv);
-}
-
static nni_tran_dialer_ops inproc_dialer_ops = {
.d_init = inproc_dialer_init,
.d_fini = inproc_ep_fini,
@@ -713,7 +683,6 @@ struct nni_tran nni_inproc_tran = {
.tran_pipe = &inproc_pipe_ops,
.tran_init = inproc_init,
.tran_fini = inproc_fini,
- .tran_checkopt = inproc_checkopt,
};
int
diff --git a/src/transport/ipc/ipc.c b/src/transport/ipc/ipc.c
index ea135ad8..9e75f13a 100644
--- a/src/transport/ipc/ipc.c
+++ b/src/transport/ipc/ipc.c
@@ -1007,7 +1007,7 @@ ipc_pipe_get(void *arg, const char *name, void *buf, size_t *szp, nni_type t)
{
ipc_pipe *p = arg;
- return (nni_stream_getx(p->conn, name, buf, szp, t));
+ return (nni_stream_get(p->conn, name, buf, szp, t));
}
static nni_tran_pipe_ops ipc_tran_pipe_ops = {
@@ -1041,7 +1041,7 @@ ipc_dialer_get(void *arg, const char *name, void *buf, size_t *szp, nni_type t)
rv = nni_getopt(ipc_ep_options, name, ep, buf, szp, t);
if (rv == NNG_ENOTSUP) {
- rv = nni_stream_dialer_getx(ep->dialer, name, buf, szp, t);
+ rv = nni_stream_dialer_get(ep->dialer, name, buf, szp, t);
}
return (rv);
}
@@ -1055,7 +1055,7 @@ ipc_dialer_set(
rv = nni_setopt(ipc_ep_options, name, ep, buf, sz, t);
if (rv == NNG_ENOTSUP) {
- rv = nni_stream_dialer_setx(ep->dialer, name, buf, sz, t);
+ rv = nni_stream_dialer_set(ep->dialer, name, buf, sz, t);
}
return (rv);
}
@@ -1069,7 +1069,7 @@ ipc_listener_get(
rv = nni_getopt(ipc_ep_options, name, ep, buf, szp, t);
if (rv == NNG_ENOTSUP) {
- rv = nni_stream_listener_getx(ep->listener, name, buf, szp, t);
+ rv = nni_stream_listener_get(ep->listener, name, buf, szp, t);
}
return (rv);
}
@@ -1083,34 +1083,7 @@ ipc_listener_set(
rv = nni_setopt(ipc_ep_options, name, ep, buf, sz, t);
if (rv == NNG_ENOTSUP) {
- rv = nni_stream_listener_setx(ep->listener, name, buf, sz, t);
- }
- return (rv);
-}
-
-static int
-ipc_check_recv_max_sz(const void *v, size_t sz, nni_type t)
-{
- return (nni_copyin_size(NULL, v, sz, 0, NNI_MAXSZ, t));
-}
-
-static nni_chkoption ipc_check_opts[] = {
- {
- .o_name = NNG_OPT_RECVMAXSZ,
- .o_check = ipc_check_recv_max_sz,
- },
- {
- .o_name = NULL,
- },
-};
-
-static int
-ipc_check_opt(const char *name, const void *buf, size_t sz, nni_type t)
-{
- int rv;
- rv = nni_chkopt(ipc_check_opts, name, buf, sz, t);
- if (rv == NNG_ENOTSUP) {
- rv = nni_stream_checkopt("ipc", name, buf, sz, t);
+ rv = nni_stream_listener_set(ep->listener, name, buf, sz, t);
}
return (rv);
}
@@ -1142,7 +1115,6 @@ static nni_tran ipc_tran = {
.tran_pipe = &ipc_tran_pipe_ops,
.tran_init = ipc_tran_init,
.tran_fini = ipc_tran_fini,
- .tran_checkopt = ipc_check_opt,
};
#ifdef NNG_PLATFORM_POSIX
@@ -1154,7 +1126,6 @@ static nni_tran ipc_tran_unix = {
.tran_pipe = &ipc_tran_pipe_ops,
.tran_init = ipc_tran_init,
.tran_fini = ipc_tran_fini,
- .tran_checkopt = ipc_check_opt,
};
#endif
@@ -1167,7 +1138,6 @@ static nni_tran ipc_tran_abstract = {
.tran_pipe = &ipc_tran_pipe_ops,
.tran_init = ipc_tran_init,
.tran_fini = ipc_tran_fini,
- .tran_checkopt = ipc_check_opt,
};
#endif
diff --git a/src/transport/tcp/tcp.c b/src/transport/tcp/tcp.c
index 02bc078e..cf0bfeb1 100644
--- a/src/transport/tcp/tcp.c
+++ b/src/transport/tcp/tcp.c
@@ -593,7 +593,7 @@ tcptran_pipe_getopt(
void *arg, const char *name, void *buf, size_t *szp, nni_type t)
{
tcptran_pipe *p = arg;
- return (nni_stream_getx(p->conn, name, buf, szp, t));
+ return (nni_stream_get(p->conn, name, buf, szp, t));
}
static void
@@ -863,11 +863,11 @@ tcptran_ep_init(tcptran_ep **epp, nng_url *url, nni_sock *sock)
#ifdef NNG_ENABLE_STATS
static const nni_stat_info rcv_max_info = {
- .si_name = "rcv_max",
- .si_desc = "maximum receive size",
- .si_type = NNG_STAT_LEVEL,
- .si_unit = NNG_UNIT_BYTES,
- .si_atomic = true,
+ .si_name = "rcv_max",
+ .si_desc = "maximum receive size",
+ .si_type = NNG_STAT_LEVEL,
+ .si_unit = NNG_UNIT_BYTES,
+ .si_atomic = true,
};
nni_stat_init(&ep->st_rcv_max, &rcv_max_info);
#endif
@@ -910,7 +910,7 @@ tcptran_dialer_init(void **dp, nng_url *url, nni_dialer *ndialer)
return (rv);
}
if ((srcsa.s_family != NNG_AF_UNSPEC) &&
- ((rv = nni_stream_dialer_setx(ep->dialer, NNG_OPT_LOCADDR, &srcsa,
+ ((rv = nni_stream_dialer_set(ep->dialer, NNG_OPT_LOCADDR, &srcsa,
sizeof(srcsa), NNI_TYPE_SOCKADDR)) != 0)) {
tcptran_ep_fini(ep);
return (rv);
@@ -1141,7 +1141,7 @@ tcptran_dialer_getopt(
tcptran_ep *ep = arg;
int rv;
- rv = nni_stream_dialer_getx(ep->dialer, name, buf, szp, t);
+ rv = nni_stream_dialer_get(ep->dialer, name, buf, szp, t);
if (rv == NNG_ENOTSUP) {
rv = nni_getopt(tcptran_ep_opts, name, ep, buf, szp, t);
}
@@ -1155,7 +1155,7 @@ tcptran_dialer_setopt(
tcptran_ep *ep = arg;
int rv;
- rv = nni_stream_dialer_setx(ep->dialer, name, buf, sz, t);
+ rv = nni_stream_dialer_set(ep->dialer, name, buf, sz, t);
if (rv == NNG_ENOTSUP) {
rv = nni_setopt(tcptran_ep_opts, name, ep, buf, sz, t);
}
@@ -1169,7 +1169,7 @@ tcptran_listener_getopt(
tcptran_ep *ep = arg;
int rv;
- rv = nni_stream_listener_getx(ep->listener, name, buf, szp, t);
+ rv = nni_stream_listener_get(ep->listener, name, buf, szp, t);
if (rv == NNG_ENOTSUP) {
rv = nni_getopt(tcptran_ep_opts, name, ep, buf, szp, t);
}
@@ -1183,40 +1183,13 @@ tcptran_listener_setopt(
tcptran_ep *ep = arg;
int rv;
- rv = nni_stream_listener_setx(ep->listener, name, buf, sz, t);
+ rv = nni_stream_listener_set(ep->listener, name, buf, sz, t);
if (rv == NNG_ENOTSUP) {
rv = nni_setopt(tcptran_ep_opts, name, ep, buf, sz, t);
}
return (rv);
}
-static int
-tcptran_check_recvmaxsz(const void *v, size_t sz, nni_type t)
-{
- return (nni_copyin_size(NULL, v, sz, 0, NNI_MAXSZ, t));
-}
-
-static nni_chkoption tcptran_checkopts[] = {
- {
- .o_name = NNG_OPT_RECVMAXSZ,
- .o_check = tcptran_check_recvmaxsz,
- },
- {
- .o_name = NULL,
- },
-};
-
-static int
-tcptran_checkopt(const char *name, const void *buf, size_t sz, nni_type t)
-{
- int rv;
- rv = nni_chkopt(tcptran_checkopts, name, buf, sz, t);
- if (rv == NNG_ENOTSUP) {
- rv = nni_stream_checkopt("tcp", name, buf, sz, t);
- }
- return (rv);
-}
-
static nni_tran_dialer_ops tcptran_dialer_ops = {
.d_init = tcptran_dialer_init,
.d_fini = tcptran_ep_fini,
@@ -1244,7 +1217,6 @@ static nni_tran tcp_tran = {
.tran_pipe = &tcptran_pipe_ops,
.tran_init = tcptran_init,
.tran_fini = tcptran_fini,
- .tran_checkopt = tcptran_checkopt,
};
static nni_tran tcp4_tran = {
@@ -1255,7 +1227,6 @@ static nni_tran tcp4_tran = {
.tran_pipe = &tcptran_pipe_ops,
.tran_init = tcptran_init,
.tran_fini = tcptran_fini,
- .tran_checkopt = tcptran_checkopt,
};
static nni_tran tcp6_tran = {
@@ -1266,7 +1237,6 @@ static nni_tran tcp6_tran = {
.tran_pipe = &tcptran_pipe_ops,
.tran_init = tcptran_init,
.tran_fini = tcptran_fini,
- .tran_checkopt = tcptran_checkopt,
};
int
diff --git a/src/transport/tls/tls.c b/src/transport/tls/tls.c
index ae5d86ec..62393d22 100644
--- a/src/transport/tls/tls.c
+++ b/src/transport/tls/tls.c
@@ -883,7 +883,7 @@ tlstran_ep_init_dialer(void **dp, nni_url *url, nni_dialer *ndialer)
return (rv);
}
if ((srcsa.s_family != NNG_AF_UNSPEC) &&
- ((rv = nni_stream_dialer_setx(ep->dialer, NNG_OPT_LOCADDR, &srcsa,
+ ((rv = nni_stream_dialer_set(ep->dialer, NNG_OPT_LOCADDR, &srcsa,
sizeof(srcsa), NNI_TYPE_SOCKADDR)) != 0)) {
tlstran_ep_fini(ep);
return (rv);
@@ -952,7 +952,7 @@ tlstran_ep_init_listener(void **lp, nni_url *url, nni_listener *nlistener)
if ((rv != 0) ||
((rv = nng_stream_listener_alloc_url(&ep->listener, url)) != 0) ||
- ((rv = nni_stream_listener_setx(ep->listener,
+ ((rv = nni_stream_listener_set(ep->listener,
NNG_OPT_TLS_AUTH_MODE, &ep->authmode, sizeof(ep->authmode),
NNI_TYPE_INT32)) != 0)) {
tlstran_ep_fini(ep);
@@ -1128,19 +1128,12 @@ tlstran_pipe_getopt(
tlstran_pipe *p = arg;
int rv;
- if ((rv = nni_stream_getx(p->tls, name, buf, szp, t)) == NNG_ENOTSUP) {
+ if ((rv = nni_stream_get(p->tls, name, buf, szp, t)) == NNG_ENOTSUP) {
rv = nni_getopt(tlstran_pipe_opts, name, p, buf, szp, t);
}
return (rv);
}
-static int
-tlstran_check_recvmaxsz(const void *v, size_t sz, nni_type t)
-{
- size_t val;
- return (nni_copyin_size(&val, v, sz, 0, NNI_MAXSZ, t));
-}
-
static nni_tran_pipe_ops tlstran_pipe_ops = {
.p_init = tlstran_pipe_init,
.p_fini = tlstran_pipe_fini,
@@ -1168,16 +1161,6 @@ static nni_option tlstran_ep_options[] = {
},
};
-static nni_chkoption tlstran_checkopts[] = {
- {
- .o_name = NNG_OPT_RECVMAXSZ,
- .o_check = tlstran_check_recvmaxsz,
- },
- {
- .o_name = NULL,
- },
-};
-
static int
tlstran_dialer_getopt(
void *arg, const char *name, void *buf, size_t *szp, nni_type t)
@@ -1185,7 +1168,7 @@ tlstran_dialer_getopt(
int rv;
tlstran_ep *ep = arg;
- rv = nni_stream_dialer_getx(ep->dialer, name, buf, szp, t);
+ rv = nni_stream_dialer_get(ep->dialer, name, buf, szp, t);
if (rv == NNG_ENOTSUP) {
rv = nni_getopt(tlstran_ep_options, name, ep, buf, szp, t);
}
@@ -1199,7 +1182,7 @@ tlstran_dialer_setopt(
int rv;
tlstran_ep *ep = arg;
- rv = nni_stream_dialer_setx(
+ rv = nni_stream_dialer_set(
ep != NULL ? ep->dialer : NULL, name, buf, sz, t);
if (rv == NNG_ENOTSUP) {
rv = nni_setopt(tlstran_ep_options, name, ep, buf, sz, t);
@@ -1208,13 +1191,13 @@ tlstran_dialer_setopt(
}
static int
-tlstran_listener_getopt(
+tlstran_listener_get(
void *arg, const char *name, void *buf, size_t *szp, nni_type t)
{
int rv;
tlstran_ep *ep = arg;
- rv = nni_stream_listener_getx(ep->listener, name, buf, szp, t);
+ rv = nni_stream_listener_get(ep->listener, name, buf, szp, t);
if (rv == NNG_ENOTSUP) {
rv = nni_getopt(tlstran_ep_options, name, ep, buf, szp, t);
}
@@ -1222,13 +1205,13 @@ tlstran_listener_getopt(
}
static int
-tlstran_listener_setopt(
+tlstran_listener_set(
void *arg, const char *name, const void *buf, size_t sz, nni_type t)
{
int rv;
tlstran_ep *ep = arg;
- rv = nni_stream_listener_setx(
+ rv = nni_stream_listener_set(
ep != NULL ? ep->listener : NULL, name, buf, sz, t);
if (rv == NNG_ENOTSUP) {
rv = nni_setopt(tlstran_ep_options, name, ep, buf, sz, t);
@@ -1236,17 +1219,6 @@ tlstran_listener_setopt(
return (rv);
}
-static int
-tlstran_checkopt(const char *name, const void *buf, size_t sz, nni_type t)
-{
- int rv;
- rv = nni_chkopt(tlstran_checkopts, name, buf, sz, t);
- if (rv == NNG_ENOTSUP) {
- rv = nni_stream_checkopt("tls+tcp", name, buf, sz, t);
- }
- return (rv);
-}
-
static nni_tran_dialer_ops tlstran_dialer_ops = {
.d_init = tlstran_ep_init_dialer,
.d_fini = tlstran_ep_fini,
@@ -1262,8 +1234,8 @@ static nni_tran_listener_ops tlstran_listener_ops = {
.l_bind = tlstran_ep_bind,
.l_accept = tlstran_ep_accept,
.l_close = tlstran_ep_close,
- .l_getopt = tlstran_listener_getopt,
- .l_setopt = tlstran_listener_setopt,
+ .l_getopt = tlstran_listener_get,
+ .l_setopt = tlstran_listener_set,
};
static nni_tran tls_tran = {
@@ -1274,7 +1246,6 @@ static nni_tran tls_tran = {
.tran_pipe = &tlstran_pipe_ops,
.tran_init = tlstran_init,
.tran_fini = tlstran_fini,
- .tran_checkopt = tlstran_checkopt,
};
static nni_tran tls4_tran = {
@@ -1285,7 +1256,6 @@ static nni_tran tls4_tran = {
.tran_pipe = &tlstran_pipe_ops,
.tran_init = tlstran_init,
.tran_fini = tlstran_fini,
- .tran_checkopt = tlstran_checkopt,
};
static nni_tran tls6_tran = {
@@ -1296,7 +1266,6 @@ static nni_tran tls6_tran = {
.tran_pipe = &tlstran_pipe_ops,
.tran_init = tlstran_init,
.tran_fini = tlstran_fini,
- .tran_checkopt = tlstran_checkopt,
};
int
diff --git a/src/transport/ws/websocket.c b/src/transport/ws/websocket.c
index 03dc4139..3f73f47f 100644
--- a/src/transport/ws/websocket.c
+++ b/src/transport/ws/websocket.c
@@ -348,7 +348,7 @@ wstran_pipe_getopt(
ws_pipe *p = arg;
int rv;
- if ((rv = nni_stream_getx(p->ws, name, buf, szp, t)) == NNG_ENOTSUP) {
+ if ((rv = nni_stream_get(p->ws, name, buf, szp, t)) == NNG_ENOTSUP) {
rv = nni_getopt(ws_pipe_options, name, p, buf, szp, t);
}
return (rv);
@@ -573,7 +573,7 @@ wstran_dialer_getopt(
ws_dialer *d = arg;
int rv;
- rv = nni_stream_dialer_getx(d->dialer, name, buf, szp, t);
+ rv = nni_stream_dialer_get(d->dialer, name, buf, szp, t);
if (rv == NNG_ENOTSUP) {
rv = nni_getopt(wstran_ep_opts, name, d, buf, szp, t);
}
@@ -587,7 +587,7 @@ wstran_dialer_setopt(
ws_dialer *d = arg;
int rv;
- rv = nni_stream_dialer_setx(d->dialer, name, buf, sz, t);
+ rv = nni_stream_dialer_set(d->dialer, name, buf, sz, t);
if (rv == NNG_ENOTSUP) {
rv = nni_setopt(wstran_ep_opts, name, d, buf, sz, t);
}
@@ -595,13 +595,13 @@ wstran_dialer_setopt(
}
static int
-wstran_listener_getopt(
+wstran_listener_get(
void *arg, const char *name, void *buf, size_t *szp, nni_type t)
{
ws_listener *l = arg;
int rv;
- rv = nni_stream_listener_getx(l->listener, name, buf, szp, t);
+ rv = nni_stream_listener_get(l->listener, name, buf, szp, t);
if (rv == NNG_ENOTSUP) {
rv = nni_getopt(wstran_ep_opts, name, l, buf, szp, t);
}
@@ -609,36 +609,19 @@ wstran_listener_getopt(
}
static int
-wstran_listener_setopt(
+wstran_listener_set(
void *arg, const char *name, const void *buf, size_t sz, nni_type t)
{
ws_listener *l = arg;
int rv;
- rv = nni_stream_listener_setx(l->listener, name, buf, sz, t);
+ rv = nni_stream_listener_set(l->listener, name, buf, sz, t);
if (rv == NNG_ENOTSUP) {
rv = nni_setopt(wstran_ep_opts, name, l, buf, sz, t);
}
return (rv);
}
-static nni_chkoption wstran_check_opts[] = {
- {
- .o_name = NULL,
- },
-};
-
-static int
-wstran_checkopt(const char *name, const void *buf, size_t sz, nni_type t)
-{
- int rv;
- rv = nni_chkopt(wstran_check_opts, name, buf, sz, t);
- if (rv == NNG_ENOTSUP) {
- rv = nni_stream_checkopt("ws", name, buf, sz, t);
- }
- return (rv);
-}
-
static nni_tran_dialer_ops ws_dialer_ops = {
.d_init = wstran_dialer_init,
.d_fini = wstran_dialer_fini,
@@ -654,8 +637,8 @@ static nni_tran_listener_ops ws_listener_ops = {
.l_bind = ws_listener_bind,
.l_accept = wstran_listener_accept,
.l_close = wstran_listener_close,
- .l_setopt = wstran_listener_setopt,
- .l_getopt = wstran_listener_getopt,
+ .l_setopt = wstran_listener_set,
+ .l_getopt = wstran_listener_get,
};
static nni_tran ws_tran = {
@@ -666,7 +649,6 @@ static nni_tran ws_tran = {
.tran_pipe = &ws_pipe_ops,
.tran_init = wstran_init,
.tran_fini = wstran_fini,
- .tran_checkopt = wstran_checkopt,
};
static nni_tran ws4_tran = {
@@ -677,7 +659,6 @@ static nni_tran ws4_tran = {
.tran_pipe = &ws_pipe_ops,
.tran_init = wstran_init,
.tran_fini = wstran_fini,
- .tran_checkopt = wstran_checkopt,
};
static nni_tran ws6_tran = {
@@ -688,7 +669,6 @@ static nni_tran ws6_tran = {
.tran_pipe = &ws_pipe_ops,
.tran_init = wstran_init,
.tran_fini = wstran_fini,
- .tran_checkopt = wstran_checkopt,
};
int
@@ -714,7 +694,6 @@ static nni_tran wss_tran = {
.tran_pipe = &ws_pipe_ops,
.tran_init = wstran_init,
.tran_fini = wstran_fini,
- .tran_checkopt = wstran_checkopt,
};
static nni_tran wss4_tran = {
@@ -725,7 +704,6 @@ static nni_tran wss4_tran = {
.tran_pipe = &ws_pipe_ops,
.tran_init = wstran_init,
.tran_fini = wstran_fini,
- .tran_checkopt = wstran_checkopt,
};
static nni_tran wss6_tran = {
@@ -736,7 +714,6 @@ static nni_tran wss6_tran = {
.tran_pipe = &ws_pipe_ops,
.tran_init = wstran_init,
.tran_fini = wstran_fini,
- .tran_checkopt = wstran_checkopt,
};
int
diff --git a/src/transport/zerotier/zerotier.c b/src/transport/zerotier/zerotier.c
index 2667d027..c66a4b2c 100644
--- a/src/transport/zerotier/zerotier.c
+++ b/src/transport/zerotier/zerotier.c
@@ -1664,52 +1664,6 @@ zt_check_tries(const void *v, size_t sz, nni_type t)
return (nni_copyin_int(NULL, v, sz, 0, 1000000, t));
}
-static nni_chkoption zt_tran_check_opts[] = {
- {
- .o_name = NNG_OPT_RECVMAXSZ,
- .o_check = zt_check_recvmaxsz,
- },
- {
- .o_name = NNG_OPT_ZT_HOME,
- .o_check = zt_check_string,
- },
- {
- .o_name = NNG_OPT_ZT_ORBIT,
- .o_check = zt_check_orbit,
- },
- {
- .o_name = NNG_OPT_ZT_DEORBIT,
- .o_check = zt_check_deorbit,
- },
- {
- .o_name = NNG_OPT_ZT_CONN_TIME,
- .o_check = zt_check_time,
- },
- {
- .o_name = NNG_OPT_ZT_PING_TIME,
- .o_check = zt_check_time,
- },
- {
- .o_name = NNG_OPT_ZT_PING_TRIES,
- .o_check = zt_check_tries,
- },
- {
- .o_name = NNG_OPT_ZT_CONN_TRIES,
- .o_check = zt_check_tries,
- },
- {
- .o_name = NULL,
- },
-};
-
-static int
-zt_tran_checkopt(const char *name, const void *buf, size_t sz, nni_type t)
-{
- int rv;
- rv = nni_chkopt(zt_tran_check_opts, name, buf, sz, t);
- return (rv);
-}
-
static void
zt_pipe_close(void *arg)
{
@@ -2647,8 +2601,7 @@ zt_ep_set_recvmaxsz(void *arg, const void *data, size_t sz, nni_type t)
size_t val;
int rv;
- if (((rv = nni_copyin_size(&val, data, sz, 0, NNI_MAXSZ, t)) == 0) &&
- (ep != NULL)) {
+ if ((rv = nni_copyin_size(&val, data, sz, 0, NNI_MAXSZ, t)) == 0) {
nni_mtx_lock(&zt_lk);
ep->ze_rcvmax = val;
nni_mtx_unlock(&zt_lk);
@@ -2673,7 +2626,7 @@ zt_ep_set_home(void *arg, const void *data, size_t sz, nni_type t)
int rv;
zt_ep *ep = arg;
- if (((rv = zt_check_string(data, sz, t)) == 0) && (ep != NULL)) {
+ if ((rv = zt_check_string(data, sz, t)) == 0) {
nni_mtx_lock(&zt_lk);
if (ep->ze_running) {
rv = NNG_ESTATE;
@@ -2740,9 +2693,6 @@ zt_ep_set_orbit(void *arg, const void *data, size_t sz, nni_type t)
} else {
return (NNG_EINVAL);
}
- if (ep == NULL) {
- return (0);
- }
nni_mtx_lock(&zt_lk);
if ((ep->ze_ztn == NULL) && ((rv = zt_node_find(ep)) != 0)) {
@@ -2762,8 +2712,7 @@ zt_ep_set_deorbit(void *arg, const void *data, size_t sz, nni_type t)
zt_ep * ep = arg;
int rv;
- if (((rv = nni_copyin_u64(&moonid, data, sz, t)) == 0) &&
- (ep != NULL)) {
+ if ((rv = nni_copyin_u64(&moonid, data, sz, t)) == 0) {
enum ZT_ResultCode zrv;
nni_mtx_lock(&zt_lk);
@@ -2810,9 +2759,6 @@ zt_ep_set_add_local_addr(void *arg, const void *data, size_t sz, nni_type t)
return (NNG_EINVAL);
}
- if (ep == NULL) {
- return (0);
- }
nni_mtx_lock(&zt_lk);
if ((ep->ze_ztn == NULL) && ((rv = zt_node_find(ep)) != 0)) {
nni_mtx_unlock(&zt_lk);
@@ -2830,22 +2776,20 @@ static int
zt_ep_set_clear_local_addrs(void *arg, const void *data, size_t sz, nni_type t)
{
zt_ep *ep = arg;
+ int rv;
NNI_ARG_UNUSED(data);
NNI_ARG_UNUSED(sz);
NNI_ARG_UNUSED(t);
- if (ep != NULL) {
- int rv;
- ZT_Node *zn;
- nni_mtx_lock(&zt_lk);
- if ((ep->ze_ztn == NULL) && ((rv = zt_node_find(ep)) != 0)) {
- nni_mtx_unlock(&zt_lk);
- return (rv);
- }
- zn = ep->ze_ztn;
- ZT_Node_clearLocalInterfaceAddresses(zn);
+ ZT_Node *zn;
+ nni_mtx_lock(&zt_lk);
+ if ((ep->ze_ztn == NULL) && ((rv = zt_node_find(ep)) != 0)) {
nni_mtx_unlock(&zt_lk);
+ return (rv);
}
+ zn = ep->ze_ztn;
+ ZT_Node_clearLocalInterfaceAddresses(zn);
+ nni_mtx_unlock(&zt_lk);
return (0);
}
@@ -2926,7 +2870,7 @@ zt_ep_set_ping_time(void *arg, const void *data, size_t sz, nni_type t)
nng_duration val;
int rv;
- if (((rv = nni_copyin_ms(&val, data, sz, t)) == 0) && (ep != NULL)) {
+ if ((rv = nni_copyin_ms(&val, data, sz, t)) == 0) {
nni_mtx_lock(&zt_lk);
ep->ze_ping_time = val;
nni_mtx_unlock(&zt_lk);
@@ -2953,8 +2897,7 @@ zt_ep_set_ping_tries(void *arg, const void *data, size_t sz, nni_type t)
int val;
int rv;
- if (((rv = nni_copyin_int(&val, data, sz, 0, 1000000, t)) == 0) &&
- (ep != NULL)) {
+ if ((rv = nni_copyin_int(&val, data, sz, 0, 1000000, t)) == 0) {
nni_mtx_lock(&zt_lk);
ep->ze_ping_tries = val;
nni_mtx_unlock(&zt_lk);
@@ -2981,7 +2924,7 @@ zt_ep_set_conn_time(void *arg, const void *data, size_t sz, nni_type t)
nng_duration val;
int rv;
- if (((rv = nni_copyin_ms(&val, data, sz, t)) == 0) && (ep != NULL)) {
+ if ((rv = nni_copyin_ms(&val, data, sz, t)) == 0) {
nni_mtx_lock(&zt_lk);
ep->ze_conn_time = val;
nni_mtx_unlock(&zt_lk);
@@ -3008,8 +2951,7 @@ zt_ep_set_conn_tries(void *arg, const void *data, size_t sz, nni_type t)
int val;
int rv;
- if (((rv = nni_copyin_int(&val, data, sz, 0, 1000000, t)) == 0) &&
- (ep != NULL)) {
+ if ((rv = nni_copyin_int(&val, data, sz, 0, 1000000, t)) == 0) {
nni_mtx_lock(&zt_lk);
ep->ze_conn_tries = val;
nni_mtx_unlock(&zt_lk);
@@ -3288,7 +3230,6 @@ static struct nni_tran zt_tran = {
.tran_pipe = &zt_pipe_ops,
.tran_init = zt_tran_init,
.tran_fini = zt_tran_fini,
- .tran_checkopt = zt_tran_checkopt,
};
int