diff options
Diffstat (limited to 'src/protocol/pubsub')
| -rw-r--r-- | src/protocol/pubsub/pub.c | 16 | ||||
| -rw-r--r-- | src/protocol/pubsub/sub.c | 22 |
2 files changed, 10 insertions, 28 deletions
diff --git a/src/protocol/pubsub/pub.c b/src/protocol/pubsub/pub.c index 940f2139..bbca1ecd 100644 --- a/src/protocol/pubsub/pub.c +++ b/src/protocol/pubsub/pub.c @@ -266,14 +266,10 @@ static int nni_pub_sock_setopt(void *arg, int opt, const void *buf, size_t sz) { nni_pub_sock *pub = arg; - int rv; + int rv = NNG_ENOTSUP; - switch (opt) { - case NNG_OPT_RAW: + if (opt == nng_optid_raw) { rv = nni_setopt_int(&pub->raw, buf, sz, 0, 1); - break; - default: - rv = NNG_ENOTSUP; } return (rv); } @@ -282,14 +278,10 @@ static int nni_pub_sock_getopt(void *arg, int opt, void *buf, size_t *szp) { nni_pub_sock *pub = arg; - int rv; + int rv = NNG_ENOTSUP; - switch (opt) { - case NNG_OPT_RAW: + if (opt == nng_optid_raw) { rv = nni_getopt_int(&pub->raw, buf, szp); - break; - default: - rv = NNG_ENOTSUP; } return (rv); } diff --git a/src/protocol/pubsub/sub.c b/src/protocol/pubsub/sub.c index 78b9d157..0563b764 100644 --- a/src/protocol/pubsub/sub.c +++ b/src/protocol/pubsub/sub.c @@ -251,20 +251,14 @@ static int nni_sub_sock_setopt(void *arg, int opt, const void *buf, size_t sz) { nni_sub_sock *sub = arg; - int rv; + int rv = NNG_ENOTSUP; - switch (opt) { - case NNG_OPT_RAW: + if (opt == nng_optid_raw) { rv = nni_setopt_int(&sub->raw, buf, sz, 0, 1); - break; - case NNG_OPT_SUBSCRIBE: + } else if (opt == nng_optid_sub_subscribe) { rv = nni_sub_subscribe(sub, buf, sz); - break; - case NNG_OPT_UNSUBSCRIBE: + } else if (opt == nng_optid_sub_unsubscribe) { rv = nni_sub_unsubscribe(sub, buf, sz); - break; - default: - rv = NNG_ENOTSUP; } return (rv); } @@ -273,14 +267,10 @@ static int nni_sub_sock_getopt(void *arg, int opt, void *buf, size_t *szp) { nni_sub_sock *sub = arg; - int rv; + int rv = NNG_ENOTSUP; - switch (opt) { - case NNG_OPT_RAW: + if (opt == nng_optid_raw) { rv = nni_getopt_int(&sub->raw, buf, szp); - break; - default: - rv = NNG_ENOTSUP; } return (rv); } |
