aboutsummaryrefslogtreecommitdiff
path: root/src/core/endpt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/endpt.c')
-rw-r--r--src/core/endpt.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/core/endpt.c b/src/core/endpt.c
index 91ddb318..326bac48 100644
--- a/src/core/endpt.c
+++ b/src/core/endpt.c
@@ -39,7 +39,7 @@ nni_ep_sys_fini(void)
int
-nni_ep_hold(nni_ep **epp, uint32_t id)
+nni_ep_find(nni_ep **epp, uint32_t id)
{
int rv;
nni_ep *ep;
@@ -67,6 +67,16 @@ nni_ep_hold(nni_ep **epp, uint32_t id)
void
+nni_ep_hold(nni_ep *ep)
+{
+ int rv;
+
+ rv = nni_objhash_find(nni_eps, ep->ep_id, NULL);
+ NNI_ASSERT(rv == 0);
+}
+
+
+void
nni_ep_rele(nni_ep *ep)
{
nni_objhash_unref(nni_eps, ep->ep_id);
@@ -226,11 +236,7 @@ nni_ep_connect(nni_ep *ep, nni_pipe **pp)
int
nni_ep_add_pipe(nni_ep *ep, nni_pipe *pipe)
{
- int rv;
-
- if ((rv = nni_ep_hold(NULL, ep->ep_id)) != 0) {
- return (rv);
- }
+ nni_ep_hold(ep);
nni_mtx_lock(&ep->ep_mtx);
if (ep->ep_close) {
nni_mtx_unlock(&ep->ep_mtx);