From f31d818c02c95484b7a9c5f8667559bd2524b071 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Fri, 14 Apr 2017 14:29:57 -0700 Subject: Pipe ID race on close (pipe IDs are zero at close). This should address some of the errors we've seen. Additionally, the scalability test was a bit brittle due to too-short timeouts. --- src/protocol/reqrep/rep.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/protocol/reqrep') diff --git a/src/protocol/reqrep/rep.c b/src/protocol/reqrep/rep.c index a7295eec..5a5f6bff 100644 --- a/src/protocol/reqrep/rep.c +++ b/src/protocol/reqrep/rep.c @@ -45,6 +45,7 @@ struct nni_rep_pipe { nni_pipe * pipe; nni_rep_sock * rep; nni_msgq * sendq; + uint32_t id; // we have to save it nni_aio aio_getq; nni_aio aio_send; nni_aio aio_recv; @@ -175,7 +176,8 @@ nni_rep_pipe_start(void *arg) nni_rep_sock *rep = rp->rep; int rv; - rv = nni_idhash_insert(&rep->pipes, nni_pipe_id(rp->pipe), rp); + rp->id = nni_pipe_id(rp->pipe); + rv = nni_idhash_insert(&rep->pipes, rp->id, rp); if (rv != 0) { return (rv); } @@ -199,7 +201,7 @@ nni_rep_pipe_stop(void *arg) rp->running = 0; nni_msgq_close(rp->sendq); nni_msgq_aio_cancel(rep->urq, &rp->aio_putq); - nni_idhash_remove(&rep->pipes, nni_pipe_id(rp->pipe)); + nni_idhash_remove(&rep->pipes, rp->id); } } @@ -302,7 +304,6 @@ nni_rep_pipe_recv_cb(void *arg) nni_msg *msg; int rv; uint8_t idbuf[4]; - uint32_t id; uint8_t *body; int hops; @@ -312,8 +313,7 @@ nni_rep_pipe_recv_cb(void *arg) return; } - id = nni_pipe_id(rp->pipe); - NNI_PUT32(idbuf, id); + NNI_PUT32(idbuf, rp->id); msg = rp->aio_recv.a_msg; rp->aio_recv.a_msg = NULL; -- cgit v1.2.3-70-g09d2