aboutsummaryrefslogtreecommitdiff
path: root/tests/pipeline.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-09-25 12:49:10 -0700
committerGarrett D'Amore <garrett@damore.org>2017-09-27 14:38:12 -0700
commit64db0f085be0c9efc6dca8d9e72d3e5a47cb792e (patch)
tree475520498d8ebe9e47e9785d8f9d209c87582400 /tests/pipeline.c
parent86a96e5bf1b207a8b1aa925e1d9f73ce834505b8 (diff)
downloadnng-64db0f085be0c9efc6dca8d9e72d3e5a47cb792e.tar.gz
nng-64db0f085be0c9efc6dca8d9e72d3e5a47cb792e.tar.bz2
nng-64db0f085be0c9efc6dca8d9e72d3e5a47cb792e.zip
Refactor option handling APIs.
This makes the APIs use string keys, and largely eliminates the use of integer option IDs altogether. The underlying registration for options is also now a bit richer, letting protcols and transports declare the actual options they use, rather than calling down into each entry point carte blanche and relying on ENOTSUP. This code may not be as fast as the integers was, but it is more intuitive, easier to extend, and is not on any hot code paths. (If you're diddling options on a hot code path you're doing something wrong.)
Diffstat (limited to 'tests/pipeline.c')
-rw-r--r--tests/pipeline.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/tests/pipeline.c b/tests/pipeline.c
index 618b7227..c7ac2dd0 100644
--- a/tests/pipeline.c
+++ b/tests/pipeline.c
@@ -1,5 +1,6 @@
//
// Copyright 2017 Garrett D'Amore <garrett@damore.org>
+// Copyright 2017 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
@@ -122,14 +123,14 @@ TestMain("PIPELINE (PUSH/PULL) pattern", {
// back during load balancing. Adding a small buffer
// ensures that we can write to each stream, even if
// the listeners are not running yet.
- So(nng_setopt_int(push, nng_optid_recvbuf, 4) == 0);
- So(nng_setopt_int(push, nng_optid_sendbuf, 4) == 0);
- So(nng_setopt_int(pull1, nng_optid_recvbuf, 4) == 0);
- So(nng_setopt_int(pull1, nng_optid_sendbuf, 4) == 0);
- So(nng_setopt_int(pull2, nng_optid_recvbuf, 4) == 0);
- So(nng_setopt_int(pull2, nng_optid_sendbuf, 4) == 0);
- So(nng_setopt_int(pull3, nng_optid_recvbuf, 4) == 0);
- So(nng_setopt_int(pull3, nng_optid_sendbuf, 4) == 0);
+ So(nng_setopt_int(push, NNG_OPT_RECVBUF, 4) == 0);
+ So(nng_setopt_int(push, NNG_OPT_SENDBUF, 4) == 0);
+ So(nng_setopt_int(pull1, NNG_OPT_RECVBUF, 4) == 0);
+ So(nng_setopt_int(pull1, NNG_OPT_SENDBUF, 4) == 0);
+ So(nng_setopt_int(pull2, NNG_OPT_RECVBUF, 4) == 0);
+ So(nng_setopt_int(pull2, NNG_OPT_SENDBUF, 4) == 0);
+ So(nng_setopt_int(pull3, NNG_OPT_RECVBUF, 4) == 0);
+ So(nng_setopt_int(pull3, NNG_OPT_SENDBUF, 4) == 0);
So(nng_msg_alloc(&abc, 0) == 0);
APPENDSTR(abc, "abc");
@@ -137,9 +138,9 @@ TestMain("PIPELINE (PUSH/PULL) pattern", {
APPENDSTR(def, "def");
usecs = 100000;
- So(nng_setopt_usec(pull1, nng_optid_recvtimeo, usecs) == 0);
- So(nng_setopt_usec(pull2, nng_optid_recvtimeo, usecs) == 0);
- So(nng_setopt_usec(pull3, nng_optid_recvtimeo, usecs) == 0);
+ So(nng_setopt_usec(pull1, NNG_OPT_RECVTIMEO, usecs) == 0);
+ So(nng_setopt_usec(pull2, NNG_OPT_RECVTIMEO, usecs) == 0);
+ So(nng_setopt_usec(pull3, NNG_OPT_RECVTIMEO, usecs) == 0);
So(nng_listen(push, addr, NULL, 0) == 0);
So(nng_dial(pull1, addr, NULL, 0) == 0);
So(nng_dial(pull2, addr, NULL, 0) == 0);