aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2023-04-19 22:34:35 -0700
committerGarrett D'Amore <garrett@damore.org>2023-04-19 22:34:35 -0700
commit0062eb8c0a87479498bf360d1f5a43900948827f (patch)
treecd7875798f8d0fef3de375b94f480782dda93b32 /src/core
parent0c22b5830f59e59851f6eab65fd692de6c6c1a0c (diff)
downloadnng-0062eb8c0a87479498bf360d1f5a43900948827f.tar.gz
nng-0062eb8c0a87479498bf360d1f5a43900948827f.tar.bz2
nng-0062eb8c0a87479498bf360d1f5a43900948827f.zip
Birth pipe object with non-zero reference.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/pipe.c10
1 files changed, 4 insertions, 6 deletions
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. <info@staysail.tech>
+// Copyright 2023 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
// Copyright 2018 Devolutions <info@devolutions.net>
//
@@ -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
+}