aboutsummaryrefslogtreecommitdiff
path: root/src/protocol/survey0
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-04-04 11:07:56 -0700
committerGarrett D'Amore <garrett@damore.org>2018-04-04 11:07:56 -0700
commit505a9bce029e51540739c853a6c9eef0ecfb2e90 (patch)
treed907679b6ab99bcb5da919db3d005d4976590c21 /src/protocol/survey0
parent0aa1de1316b46bb4af23fdf26759bca08008eaf5 (diff)
downloadnng-505a9bce029e51540739c853a6c9eef0ecfb2e90.tar.gz
nng-505a9bce029e51540739c853a6c9eef0ecfb2e90.tar.bz2
nng-505a9bce029e51540739c853a6c9eef0ecfb2e90.zip
fixes #329 type checking not done for setopt
Diffstat (limited to 'src/protocol/survey0')
-rw-r--r--src/protocol/survey0/respond.c8
-rw-r--r--src/protocol/survey0/survey.c12
2 files changed, 10 insertions, 10 deletions
diff --git a/src/protocol/survey0/respond.c b/src/protocol/survey0/respond.c
index 035e51b1..eeb09d2a 100644
--- a/src/protocol/survey0/respond.c
+++ b/src/protocol/survey0/respond.c
@@ -347,13 +347,13 @@ resp0_putq_cb(void *arg)
}
static int
-resp0_sock_setopt_raw(void *arg, const void *buf, size_t sz)
+resp0_sock_setopt_raw(void *arg, const void *buf, size_t sz, int typ)
{
resp0_sock *s = arg;
int rv;
nni_mtx_lock(&s->mtx);
- rv = nni_setopt_bool(&s->raw, buf, sz);
+ rv = nni_copyin_bool(&s->raw, buf, sz, typ);
nni_mtx_unlock(&s->mtx);
return (rv);
}
@@ -366,10 +366,10 @@ resp0_sock_getopt_raw(void *arg, void *buf, size_t *szp, int typ)
}
static int
-resp0_sock_setopt_maxttl(void *arg, const void *buf, size_t sz)
+resp0_sock_setopt_maxttl(void *arg, const void *buf, size_t sz, int typ)
{
resp0_sock *s = arg;
- return (nni_setopt_int(&s->ttl, buf, sz, 1, 255));
+ return (nni_copyin_int(&s->ttl, buf, sz, 1, 255, typ));
}
static int
diff --git a/src/protocol/survey0/survey.c b/src/protocol/survey0/survey.c
index 161a5002..a5909015 100644
--- a/src/protocol/survey0/survey.c
+++ b/src/protocol/survey0/survey.c
@@ -275,13 +275,13 @@ failed:
}
static int
-surv0_sock_setopt_raw(void *arg, const void *buf, size_t sz)
+surv0_sock_setopt_raw(void *arg, const void *buf, size_t sz, int typ)
{
surv0_sock *s = arg;
int rv;
nni_mtx_lock(&s->mtx);
- if ((rv = nni_setopt_bool(&s->raw, buf, sz)) == 0) {
+ if ((rv = nni_copyin_bool(&s->raw, buf, sz, typ)) == 0) {
s->survid = 0;
nni_timer_cancel(&s->timer);
}
@@ -297,10 +297,10 @@ surv0_sock_getopt_raw(void *arg, void *buf, size_t *szp, int typ)
}
static int
-surv0_sock_setopt_maxttl(void *arg, const void *buf, size_t sz)
+surv0_sock_setopt_maxttl(void *arg, const void *buf, size_t sz, int typ)
{
surv0_sock *s = arg;
- return (nni_setopt_int(&s->ttl, buf, sz, 1, 255));
+ return (nni_copyin_int(&s->ttl, buf, sz, 1, 255, typ));
}
static int
@@ -311,10 +311,10 @@ surv0_sock_getopt_maxttl(void *arg, void *buf, size_t *szp, int typ)
}
static int
-surv0_sock_setopt_surveytime(void *arg, const void *buf, size_t sz)
+surv0_sock_setopt_surveytime(void *arg, const void *buf, size_t sz, int typ)
{
surv0_sock *s = arg;
- return (nni_setopt_ms(&s->survtime, buf, sz));
+ return (nni_copyin_ms(&s->survtime, buf, sz, typ));
}
static int