diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-03-18 12:46:31 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-03-18 12:46:31 -0700 |
| commit | 8b979454d891b84da727a329906c4293fadc5f3c (patch) | |
| tree | cb491c476080de11c7fc5b5868579f4ef86f4df4 /src/protocol/bus0 | |
| parent | 3a2af394a7d94ac5f924aaea6cbad825a9b05d75 (diff) | |
| download | nng-8b979454d891b84da727a329906c4293fadc5f3c.tar.gz nng-8b979454d891b84da727a329906c4293fadc5f3c.tar.bz2 nng-8b979454d891b84da727a329906c4293fadc5f3c.zip | |
fixes #295 boolean options should use C99 bool type
fixes #275 nng_pipe_getopt_ptr() missing?
fixes #285 nng_setopt_ptr MIS
fixes #297 nng_listener/dialer_close does not validate mode
This change adds some missing APIs, and changes others.
In particular, certain options are now of type bool, with size
of just one. This is a *breaking* change for code that uses those
options -- NNG_OPT_RAW, NNG_OPT_PAIR1_POLY, NNG_OPT_TLS_VERIFIED.
Diffstat (limited to 'src/protocol/bus0')
| -rw-r--r-- | src/protocol/bus0/bus.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/protocol/bus0/bus.c b/src/protocol/bus0/bus.c index 1176bf01..d2b51cd4 100644 --- a/src/protocol/bus0/bus.c +++ b/src/protocol/bus0/bus.c @@ -8,6 +8,7 @@ // found online at https://opensource.org/licenses/MIT. // +#include <stdbool.h> #include <stdlib.h> #include <string.h> @@ -41,7 +42,7 @@ static void bus0_pipe_putq_cb(void *); // bus0_sock is our per-socket protocol private structure. struct bus0_sock { - int raw; + bool raw; nni_aio * aio_getq; nni_list pipes; nni_mtx mtx; @@ -88,7 +89,7 @@ bus0_sock_init(void **sp, nni_sock *nsock) bus0_sock_fini(s); return (rv); } - s->raw = 0; + s->raw = false; s->uwq = nni_sock_sendq(nsock); s->urq = nni_sock_recvq(nsock); @@ -336,14 +337,14 @@ static int bus0_sock_setopt_raw(void *arg, const void *buf, size_t sz) { bus0_sock *s = arg; - return (nni_setopt_int(&s->raw, buf, sz, 0, 1)); + return (nni_setopt_bool(&s->raw, buf, sz)); } static int bus0_sock_getopt_raw(void *arg, void *buf, size_t *szp) { bus0_sock *s = arg; - return (nni_getopt_int(s->raw, buf, szp)); + return (nni_getopt_bool(s->raw, buf, szp)); } static void |
