From 8049d822b3d8ea8bd11793369004c638d833964e Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 18 Jan 2017 18:29:41 -0800 Subject: fixes #12 SURVEY hang in Travis --- src/core/pipe.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/core/pipe.c') diff --git a/src/core/pipe.c b/src/core/pipe.c index a1a423e7..39b4d012 100644 --- a/src/core/pipe.c +++ b/src/core/pipe.c @@ -187,6 +187,7 @@ nni_pipe_start(nni_pipe *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); @@ -196,19 +197,20 @@ nni_pipe_start(nni_pipe *pipe) if ((rv = sock->s_pipe_ops.pipe_add(pipe->p_proto_data)) != 0) { nni_mtx_lock(nni_idlock); nni_idhash_remove(nni_pipes, pipe->p_id); - nni_mtx_unlock(nni_idlock); pipe->p_id = 0; + nni_mtx_unlock(nni_idlock); + nni_pipe_bail(pipe); nni_mtx_unlock(&sock->s_mx); return (rv); } + pipe->p_active = 1; nni_list_append(&sock->s_pipes, pipe); for (i = 0; i < NNI_MAXWORKERS; i++) { nni_thr_run(&pipe->p_worker_thr[i]); } - pipe->p_active = 1; // XXX: Publish event -- cgit v1.2.3-70-g09d2