diff options
Diffstat (limited to 'src/protocol/survey0')
| -rw-r--r-- | src/protocol/survey0/respond.c | 4 | ||||
| -rw-r--r-- | src/protocol/survey0/xrespond.c | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/protocol/survey0/respond.c b/src/protocol/survey0/respond.c index 201811de..19dedef0 100644 --- a/src/protocol/survey0/respond.c +++ b/src/protocol/survey0/respond.c @@ -480,12 +480,14 @@ resp0_pipe_recv_cb(void *arg) nni_aio * aio; int hops; size_t len; + int ttl; if (nni_aio_result(&p->aio_recv) != 0) { nni_pipe_close(p->npipe); return; } + ttl = nni_atomic_get(&s->ttl); msg = nni_aio_get_msg(&p->aio_recv); nni_msg_set_pipe(msg, p->id); @@ -495,7 +497,7 @@ resp0_pipe_recv_cb(void *arg) bool end = 0; uint8_t *body; - if (hops > nni_atomic_get(&s->ttl)) { + if (hops > ttl) { goto drop; } hops++; diff --git a/src/protocol/survey0/xrespond.c b/src/protocol/survey0/xrespond.c index 65bd047e..73e541d3 100644 --- a/src/protocol/survey0/xrespond.c +++ b/src/protocol/survey0/xrespond.c @@ -273,13 +273,12 @@ xresp0_recv_cb(void *arg) int hops; int ttl; - ttl = nni_atomic_get(&s->ttl); - if (nni_aio_result(p->aio_recv) != 0) { nni_pipe_close(p->npipe); return; } + ttl = nni_atomic_get(&s->ttl); msg = nni_aio_get_msg(p->aio_recv); nni_aio_set_msg(p->aio_recv, NULL); nni_msg_set_pipe(msg, p->id); |
