aboutsummaryrefslogtreecommitdiff
path: root/src/core/device.c
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 /src/core/device.c
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 'src/core/device.c')
-rw-r--r--src/core/device.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/device.c b/src/core/device.c
index bdfcf0a6..e7140664 100644
--- a/src/core/device.c
+++ b/src/core/device.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
@@ -90,10 +91,10 @@ nni_device(nni_sock *sock1, nni_sock *sock2)
// No timeouts.
sz = sizeof(never);
- if ((nni_sock_setopt(sock1, NNG_OPT_RCVTIMEO, &never, sz) != 0) ||
- (nni_sock_setopt(sock2, NNG_OPT_RCVTIMEO, &never, sz) != 0) ||
- (nni_sock_setopt(sock1, NNG_OPT_SNDTIMEO, &never, sz) != 0) ||
- (nni_sock_setopt(sock2, NNG_OPT_SNDTIMEO, &never, sz) != 0)) {
+ if ((nni_sock_setopt(sock1, nng_optid_recvtimeo, &never, sz) != 0) ||
+ (nni_sock_setopt(sock2, nng_optid_recvtimeo, &never, sz) != 0) ||
+ (nni_sock_setopt(sock1, nng_optid_sendtimeo, &never, sz) != 0) ||
+ (nni_sock_setopt(sock2, nng_optid_sendtimeo, &never, sz) != 0)) {
// This should never happen.
rv = NNG_EINVAL;
goto out;