aboutsummaryrefslogtreecommitdiff
path: root/src/protocol/reqrep0/xrep.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocol/reqrep0/xrep.c')
-rw-r--r--src/protocol/reqrep0/xrep.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/protocol/reqrep0/xrep.c b/src/protocol/reqrep0/xrep.c
index e5d96f02..a036e6f6 100644
--- a/src/protocol/reqrep0/xrep.c
+++ b/src/protocol/reqrep0/xrep.c
@@ -283,12 +283,15 @@ xrep0_pipe_recv_cb(void *arg)
xrep0_sock *s = p->rep;
nni_msg * msg;
int hops;
+ int ttl;
if (nni_aio_result(&p->aio_recv) != 0) {
nni_pipe_close(p->pipe);
return;
}
+ ttl = nni_atomic_get(&s->ttl);
+
msg = nni_aio_get_msg(&p->aio_recv);
nni_aio_set_msg(&p->aio_recv, NULL);
@@ -302,7 +305,7 @@ xrep0_pipe_recv_cb(void *arg)
for (;;) {
bool end = 0;
uint8_t *body;
- if (hops > (int)nni_atomic_get(&s->ttl)) {
+ if (hops > ttl) {
// This isn't malformed, but it has gone through
// too many hops. Do not disconnect, because we
// can legitimately receive messages with too many