diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-09-25 12:49:10 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-09-27 14:38:12 -0700 |
| commit | 64db0f085be0c9efc6dca8d9e72d3e5a47cb792e (patch) | |
| tree | 475520498d8ebe9e47e9785d8f9d209c87582400 /tests/scalability.c | |
| parent | 86a96e5bf1b207a8b1aa925e1d9f73ce834505b8 (diff) | |
| download | nng-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/scalability.c')
| -rw-r--r-- | tests/scalability.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/scalability.c b/tests/scalability.c index 4b467b67..22b66d10 100644 --- a/tests/scalability.c +++ b/tests/scalability.c @@ -55,8 +55,8 @@ openclients(nng_socket *clients, int num) t = 100000; // 100ms nng_socket c; if (((rv = nng_req_open(&c)) != 0) || - ((rv = nng_setopt_usec(c, nng_optid_recvtimeo, t)) != 0) || - ((rv = nng_setopt_usec(c, nng_optid_sendtimeo, t)) != 0) || + ((rv = nng_setopt_usec(c, NNG_OPT_RECVTIMEO, t)) != 0) || + ((rv = nng_setopt_usec(c, NNG_OPT_SENDTIMEO, t)) != 0) || ((rv = nng_dial(c, addr, NULL, 0)) != 0)) { return (rv); } @@ -97,8 +97,8 @@ Main({ results = calloc(nclients, sizeof(int)); if ((nng_rep_open(&rep) != 0) || - (nng_setopt_int(rep, nng_optid_recvbuf, 256) != 0) || - (nng_setopt_int(rep, nng_optid_sendbuf, 256) != 0) || + (nng_setopt_int(rep, NNG_OPT_RECVBUF, 256) != 0) || + (nng_setopt_int(rep, NNG_OPT_SENDBUF, 256) != 0) || (nng_listen(rep, addr, NULL, 0) != 0) || (nng_thread_create(&server, serve, NULL) != 0)) { fprintf(stderr, "Unable to set up server!\n"); |
