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/pair1/pair.c | |
| 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/pair1/pair.c')
| -rw-r--r-- | src/protocol/pair1/pair.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/protocol/pair1/pair.c b/src/protocol/pair1/pair.c index 3f6f63fc..b4519221 100644 --- a/src/protocol/pair1/pair.c +++ b/src/protocol/pair1/pair.c @@ -1,6 +1,6 @@ // -// Copyright 2017 Garrett D'Amore <garrett@damore.org> -// Copyright 2017 Capitar IT Group BV <info@capitar.com> +// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2018 Capitar IT Group BV <info@capitar.com> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -37,13 +37,13 @@ static void pair1_pipe_fini(void *); struct pair1_sock { nni_msgq * uwq; nni_msgq * urq; - int raw; + bool raw; int ttl; nni_mtx mtx; nni_idhash *pipes; nni_list plist; - int started; - int poly; + bool started; + bool poly; nni_aio * aio_getq; }; @@ -94,8 +94,8 @@ pair1_sock_init(void **sp, nni_sock *nsock) return (rv); } - s->raw = 0; - s->poly = 0; + s->raw = false; + s->poly = false; s->uwq = nni_sock_sendq(nsock); s->urq = nni_sock_recvq(nsock); s->ttl = 8; @@ -167,7 +167,7 @@ pair1_pipe_start(void *arg) } } nni_list_append(&s->plist, p); - s->started = 1; + s->started = true; nni_mtx_unlock(&s->mtx); // Schedule a getq. In polyamorous mode we get on the per pipe @@ -402,7 +402,7 @@ pair1_sock_setopt_raw(void *arg, const void *buf, size_t sz) pair1_sock *s = arg; int rv; nni_mtx_lock(&s->mtx); - rv = s->started ? NNG_ESTATE : nni_setopt_int(&s->raw, buf, sz, 0, 1); + rv = s->started ? NNG_ESTATE : nni_setopt_bool(&s->raw, buf, sz); nni_mtx_unlock(&s->mtx); return (rv); } @@ -411,7 +411,7 @@ static int pair1_sock_getopt_raw(void *arg, void *buf, size_t *szp) { pair1_sock *s = arg; - return (nni_getopt_int(s->raw, buf, szp)); + return (nni_getopt_bool(s->raw, buf, szp)); } static int @@ -438,7 +438,7 @@ pair1_sock_setopt_poly(void *arg, const void *buf, size_t sz) pair1_sock *s = arg; int rv; nni_mtx_lock(&s->mtx); - rv = s->started ? NNG_ESTATE : nni_setopt_int(&s->poly, buf, sz, 0, 1); + rv = s->started ? NNG_ESTATE : nni_setopt_bool(&s->poly, buf, sz); nni_mtx_unlock(&s->mtx); return (rv); } @@ -447,7 +447,7 @@ static int pair1_sock_getopt_poly(void *arg, void *buf, size_t *szp) { pair1_sock *s = arg; - return (nni_getopt_int(s->poly, buf, szp)); + return (nni_getopt_bool(s->poly, buf, szp)); } static void |
