summaryrefslogtreecommitdiff
path: root/perf
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 /perf
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 'perf')
-rw-r--r--perf/perf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/perf/perf.c b/perf/perf.c
index 628bbec7..3cb451b2 100644
--- a/perf/perf.c
+++ b/perf/perf.c
@@ -360,9 +360,9 @@ throughput_server(const char *addr, int msgsize, int count)
if ((rv = nng_pair_open(&s)) != 0) {
die("nng_socket: %s", nng_strerror(rv));
}
- rv = nng_setopt_int(s, nng_optid_recvbuf, 128);
+ rv = nng_setopt_int(s, NNG_OPT_RECVBUF, 128);
if (rv != 0) {
- die("nng_setopt(nng_optid_recvbuf): %s", nng_strerror(rv));
+ die("nng_setopt(nng_opt_recvbuf): %s", nng_strerror(rv));
}
// XXX: set no delay
@@ -420,9 +420,9 @@ throughput_client(const char *addr, int msgsize, int count)
// XXX: set no delay
// XXX: other options (TLS in the future?, Linger?)
- rv = nng_setopt_int(s, nng_optid_sendbuf, 128);
+ rv = nng_setopt_int(s, NNG_OPT_SENDBUF, 128);
if (rv != 0) {
- die("nng_setopt(nng_optid_sendbuf): %s", nng_strerror(rv));
+ die("nng_setopt(nng_opt_sendbuf): %s", nng_strerror(rv));
}
if ((rv = nng_dial(s, addr, NULL, 0)) != 0) {