diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-04-14 14:29:57 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-04-14 14:29:57 -0700 |
| commit | f31d818c02c95484b7a9c5f8667559bd2524b071 (patch) | |
| tree | 501bf4d7c6f08af8ebd519d848a2f2b624f8a3e9 /src/protocol/reqrep | |
| parent | 349c1c738c345d6a3930bc5f44cf3e43b2031f54 (diff) | |
| download | nng-f31d818c02c95484b7a9c5f8667559bd2524b071.tar.gz nng-f31d818c02c95484b7a9c5f8667559bd2524b071.tar.bz2 nng-f31d818c02c95484b7a9c5f8667559bd2524b071.zip | |
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.
Diffstat (limited to 'src/protocol/reqrep')
| -rw-r--r-- | src/protocol/reqrep/rep.c | 10 |
1 files changed, 5 insertions, 5 deletions
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; |
