From 0062eb8c0a87479498bf360d1f5a43900948827f Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 19 Apr 2023 22:34:35 -0700 Subject: Birth pipe object with non-zero reference. --- src/core/pipe.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/core/pipe.c b/src/core/pipe.c index 36b77d91..06a57bf5 100644 --- a/src/core/pipe.c +++ b/src/core/pipe.c @@ -1,5 +1,5 @@ // -// Copyright 2021 Staysail Systems, Inc. +// Copyright 2023 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // Copyright 2018 Devolutions // @@ -249,7 +249,7 @@ pipe_create(nni_pipe **pp, nni_sock *sock, nni_sp_tran *tran, void *tran_data) p->p_proto_ops = *pops; p->p_sock = sock; p->p_cbs = false; - p->p_ref = 0; + p->p_ref = 1; nni_atomic_init_bool(&p->p_closed); nni_atomic_flag_reset(&p->p_stop); @@ -259,9 +259,7 @@ pipe_create(nni_pipe **pp, nni_sock *sock, nni_sp_tran *tran, void *tran_data) nni_cv_init(&p->p_cv, &pipes_lk); nni_mtx_lock(&pipes_lk); - if ((rv = nni_id_alloc(&pipes, &p->p_id, p)) == 0) { - p->p_ref = 1; - } + rv = nni_id_alloc(&pipes, &p->p_id, p); nni_mtx_unlock(&pipes_lk); #ifdef NNG_ENABLE_STATS @@ -410,4 +408,4 @@ nni_pipe_bump_error(nni_pipe *p, int err) } else { nni_listener_bump_error(p->p_listener, err); } -} \ No newline at end of file +} -- cgit v1.2.3-70-g09d2