diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-08-24 14:15:48 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-08-24 14:20:34 -0700 |
| commit | c9a68bfe6bea2acc708bf49045f6cb65017a3306 (patch) | |
| tree | e2b93b81b2962bdfb7953cb30fcfae08f0bd4093 /src/protocol/pipeline | |
| parent | 68ff9c823d3cead2b11a003c40c8f5affc11dc71 (diff) | |
| download | nng-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/protocol/pipeline')
| -rw-r--r-- | src/protocol/pipeline/pull.c | 16 | ||||
| -rw-r--r-- | src/protocol/pipeline/push.c | 16 |
2 files changed, 8 insertions, 24 deletions
diff --git a/src/protocol/pipeline/pull.c b/src/protocol/pipeline/pull.c index 1ebcc4a2..1d738ec2 100644 --- a/src/protocol/pipeline/pull.c +++ b/src/protocol/pipeline/pull.c @@ -170,14 +170,10 @@ static int nni_pull_sock_setopt(void *arg, int opt, const void *buf, size_t sz) { nni_pull_sock *pull = arg; - int rv; + int rv = NNG_ENOTSUP; - switch (opt) { - case NNG_OPT_RAW: + if (opt == nng_optid_raw) { rv = nni_setopt_int(&pull->raw, buf, sz, 0, 1); - break; - default: - rv = NNG_ENOTSUP; } return (rv); } @@ -186,14 +182,10 @@ static int nni_pull_sock_getopt(void *arg, int opt, void *buf, size_t *szp) { nni_pull_sock *pull = arg; - int rv; + int rv = NNG_ENOTSUP; - switch (opt) { - case NNG_OPT_RAW: + if (opt == nng_optid_raw) { rv = nni_getopt_int(&pull->raw, buf, szp); - break; - default: - rv = NNG_ENOTSUP; } return (rv); } diff --git a/src/protocol/pipeline/push.c b/src/protocol/pipeline/push.c index 1bc1659c..10d04091 100644 --- a/src/protocol/pipeline/push.c +++ b/src/protocol/pipeline/push.c @@ -192,14 +192,10 @@ static int nni_push_sock_setopt(void *arg, int opt, const void *buf, size_t sz) { nni_push_sock *push = arg; - int rv; + int rv = NNG_ENOTSUP; - switch (opt) { - case NNG_OPT_RAW: + if (opt == nng_optid_raw) { rv = nni_setopt_int(&push->raw, buf, sz, 0, 1); - break; - default: - rv = NNG_ENOTSUP; } return (rv); } @@ -208,14 +204,10 @@ static int nni_push_sock_getopt(void *arg, int opt, void *buf, size_t *szp) { nni_push_sock *push = arg; - int rv; + int rv = NNG_ENOTSUP; - switch (opt) { - case NNG_OPT_RAW: + if (opt == nng_optid_raw) { rv = nni_getopt_int(&push->raw, buf, szp); - break; - default: - rv = NNG_ENOTSUP; } return (rv); } |
