aboutsummaryrefslogtreecommitdiff
path: root/src/core/pipe.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-01-17 19:57:56 -0800
committerGarrett D'Amore <garrett@damore.org>2017-01-17 19:57:56 -0800
commit5633a467a009945a4f1eb06f7ffe9f02b833567f (patch)
treee0010755849424d1bc2b43940f537b5757052ebf /src/core/pipe.c
parenta00f1938497e629187ebc6035e03bb58d1017730 (diff)
downloadnng-5633a467a009945a4f1eb06f7ffe9f02b833567f.tar.gz
nng-5633a467a009945a4f1eb06f7ffe9f02b833567f.tar.bz2
nng-5633a467a009945a4f1eb06f7ffe9f02b833567f.zip
Pipe IDs are now tracked on global ID hashes.
Diffstat (limited to 'src/core/pipe.c')
-rw-r--r--src/core/pipe.c8
1 files changed, 6 insertions, 2 deletions
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);