aboutsummaryrefslogtreecommitdiff
path: root/src/protocol/pubsub0
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/pubsub0
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/pubsub0')
-rw-r--r--src/protocol/pubsub0/pub.c4
-rw-r--r--src/protocol/pubsub0/sub.c10
2 files changed, 8 insertions, 6 deletions
diff --git a/src/protocol/pubsub0/pub.c b/src/protocol/pubsub0/pub.c
index 3f4ecea6..aaa22801 100644
--- a/src/protocol/pubsub0/pub.c
+++ b/src/protocol/pubsub0/pub.c
@@ -274,10 +274,10 @@ pub0_pipe_send_cb(void *arg)
}
static int
-pub0_sock_setopt_raw(void *arg, const void *buf, size_t sz)
+pub0_sock_setopt_raw(void *arg, const void *buf, size_t sz, int typ)
{
pub0_sock *s = arg;
- return (nni_setopt_bool(&s->raw, buf, sz));
+ return (nni_copyin_bool(&s->raw, buf, sz, typ));
}
static int
diff --git a/src/protocol/pubsub0/sub.c b/src/protocol/pubsub0/sub.c
index d7e9aea4..6b1f1173 100644
--- a/src/protocol/pubsub0/sub.c
+++ b/src/protocol/pubsub0/sub.c
@@ -190,11 +190,12 @@ sub0_putq_cb(void *arg)
// to replace this with a patricia trie, like old nanomsg had.
static int
-sub0_subscribe(void *arg, const void *buf, size_t sz)
+sub0_subscribe(void *arg, const void *buf, size_t sz, int typ)
{
sub0_sock * s = arg;
sub0_topic *topic;
sub0_topic *newtopic;
+ NNI_ARG_UNUSED(typ);
nni_mtx_lock(&s->lk);
NNI_LIST_FOREACH (&s->topics, topic) {
@@ -240,11 +241,12 @@ sub0_subscribe(void *arg, const void *buf, size_t sz)
}
static int
-sub0_unsubscribe(void *arg, const void *buf, size_t sz)
+sub0_unsubscribe(void *arg, const void *buf, size_t sz, int typ)
{
sub0_sock * s = arg;
sub0_topic *topic;
int rv;
+ NNI_ARG_UNUSED(typ);
nni_mtx_lock(&s->lk);
NNI_LIST_FOREACH (&s->topics, topic) {
@@ -276,10 +278,10 @@ sub0_unsubscribe(void *arg, const void *buf, size_t sz)
}
static int
-sub0_sock_setopt_raw(void *arg, const void *buf, size_t sz)
+sub0_sock_setopt_raw(void *arg, const void *buf, size_t sz, int typ)
{
sub0_sock *s = arg;
- return (nni_setopt_bool(&s->raw, buf, sz));
+ return (nni_copyin_bool(&s->raw, buf, sz, typ));
}
static int