diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-11-03 17:49:13 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-11-03 17:49:13 -0700 |
| commit | fdc14a51e9ba787804a105b929918919394b6197 (patch) | |
| tree | 076be53033ab3aad320ea511449fe439d834e8e5 | |
| parent | 7bf591e20a94b8d926f92ab9b320f3b75d342345 (diff) | |
| download | nng-fdc14a51e9ba787804a105b929918919394b6197.tar.gz nng-fdc14a51e9ba787804a105b929918919394b6197.tar.bz2 nng-fdc14a51e9ba787804a105b929918919394b6197.zip | |
fixes #147 surveyor protocol needs NNG_OPT_MAXTTL
| -rw-r--r-- | src/protocol/survey0/survey.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/protocol/survey0/survey.c b/src/protocol/survey0/survey.c index 02283436..b3ea0323 100644 --- a/src/protocol/survey0/survey.c +++ b/src/protocol/survey0/survey.c @@ -40,6 +40,7 @@ struct surv0_sock { nni_duration survtime; nni_time expire; int raw; + int ttl; int closing; uint32_t nextid; // next id uint32_t survid; // outstanding request ID (big endian) @@ -97,6 +98,7 @@ surv0_sock_init(void **sp, nni_sock *nsock) s->expire = NNI_TIME_ZERO; s->uwq = nni_sock_sendq(nsock); s->urq = nni_sock_recvq(nsock); + s->ttl = 8; *sp = s; return (0); @@ -296,6 +298,20 @@ surv0_sock_getopt_raw(void *arg, void *buf, size_t *szp) } static int +surv0_sock_setopt_maxttl(void *arg, const void *buf, size_t sz) +{ + surv0_sock *s = arg; + return (nni_setopt_int(&s->ttl, buf, sz, 1, 255)); +} + +static int +surv0_sock_getopt_maxttl(void *arg, void *buf, size_t *szp) +{ + surv0_sock *s = arg; + return (nni_getopt_int(s->ttl, buf, szp)); +} + +static int surv0_sock_setopt_surveytime(void *arg, const void *buf, size_t sz) { surv0_sock *s = arg; |
