aboutsummaryrefslogtreecommitdiff
path: root/perf
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-08-24 14:15:48 -0700
committerGarrett D'Amore <garrett@damore.org>2017-08-24 14:20:34 -0700
commitc9a68bfe6bea2acc708bf49045f6cb65017a3306 (patch)
treee2b93b81b2962bdfb7953cb30fcfae08f0bd4093 /perf
parent68ff9c823d3cead2b11a003c40c8f5affc11dc71 (diff)
downloadnng-c9a68bfe6bea2acc708bf49045f6cb65017a3306.tar.gz
nng-c9a68bfe6bea2acc708bf49045f6cb65017a3306.tar.bz2
nng-c9a68bfe6bea2acc708bf49045f6cb65017a3306.zip
Eliminate legacy option settings, provide easier option IDs.
This eliminates all the old #define's or enum values, making all option IDs now totally dynamic, and providing well-known string values for well-behaved applications. We have added tests of some of these options, including lookups, and so forth. We have also fixed a few problems; including at least one crasher bug when the timeouts on reconnect were zero. Protocol specific options are now handled in the protocol. We will be moving the initialization for a few of those well known entities to the protocol startup code, following the PAIRv1 pattern, later. Applications must therefore not depend on the value of the integer IDs, at least until the application has opened a socket of the appropriate type.
Diffstat (limited to 'perf')
-rw-r--r--perf/perf.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/perf/perf.c b/perf/perf.c
index 1319fffc..628bbec7 100644
--- a/perf/perf.c
+++ b/perf/perf.c
@@ -354,17 +354,15 @@ throughput_server(const char *addr, int msgsize, int count)
nng_msg * msg;
int rv;
int i;
- size_t len;
uint64_t start, end;
double msgpersec, mbps, total;
if ((rv = nng_pair_open(&s)) != 0) {
die("nng_socket: %s", nng_strerror(rv));
}
- len = 128;
- rv = nng_setopt(s, NNG_OPT_RCVBUF, &len, sizeof(len));
+ rv = nng_setopt_int(s, nng_optid_recvbuf, 128);
if (rv != 0) {
- die("nng_setopt(NNG_OPT_RCVBUF): %s", nng_strerror(rv));
+ die("nng_setopt(nng_optid_recvbuf): %s", nng_strerror(rv));
}
// XXX: set no delay
@@ -411,7 +409,6 @@ throughput_client(const char *addr, int msgsize, int count)
nng_msg * msg;
int rv;
int i;
- int len;
// We send one extra zero length message to start the timer.
count++;
@@ -423,10 +420,9 @@ throughput_client(const char *addr, int msgsize, int count)
// XXX: set no delay
// XXX: other options (TLS in the future?, Linger?)
- len = 128;
- rv = nng_setopt(s, NNG_OPT_SNDBUF, &len, sizeof(len));
+ rv = nng_setopt_int(s, nng_optid_sendbuf, 128);
if (rv != 0) {
- die("nng_setopt(NNG_OPT_SNDBUF): %s", nng_strerror(rv));
+ die("nng_setopt(nng_optid_sendbuf): %s", nng_strerror(rv));
}
if ((rv = nng_dial(s, addr, NULL, 0)) != 0) {