From 5633a467a009945a4f1eb06f7ffe9f02b833567f Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Tue, 17 Jan 2017 19:57:56 -0800 Subject: Pipe IDs are now tracked on global ID hashes. --- src/core/pipe.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/core/pipe.c') diff --git a/src/core/pipe.c b/src/core/pipe.c index 6cc93d98..a1a423e7 100644 --- a/src/core/pipe.c +++ b/src/core/pipe.c @@ -184,7 +184,9 @@ nni_pipe_start(nni_pipe *pipe) return (NNG_EPROTO); } - rv = nni_idhash_alloc(sock->s_pipes_by_id, &pipe->p_id, pipe); + nni_mtx_lock(nni_idlock); + rv = nni_idhash_alloc(nni_pipes, &pipe->p_id, pipe); + nni_mtx_unlock(nni_idlock); if (rv != 0) { nni_pipe_bail(pipe); nni_mtx_unlock(&sock->s_mx); @@ -192,7 +194,9 @@ nni_pipe_start(nni_pipe *pipe) } if ((rv = sock->s_pipe_ops.pipe_add(pipe->p_proto_data)) != 0) { - nni_idhash_remove(sock->s_pipes_by_id, pipe->p_id); + nni_mtx_lock(nni_idlock); + nni_idhash_remove(nni_pipes, pipe->p_id); + nni_mtx_unlock(nni_idlock); pipe->p_id = 0; nni_pipe_bail(pipe); nni_mtx_unlock(&sock->s_mx); -- cgit v1.2.3-70-g09d2