From 3fd43c488b47874db22a87a1d87eed94bbd85725 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 1 Jan 2017 14:34:29 -0800 Subject: Pipe simplifications for thread management. This may also address a race in closing down pipes. Now pipes are always registered with the socket. They also always have both a sender and receiver thread. If the protocol doesn't need one or the other, the stock thread just exits early. --- src/core/endpt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/core/endpt.c') diff --git a/src/core/endpt.c b/src/core/endpt.c index c87c8ce6..a04cfa00 100644 --- a/src/core/endpt.c +++ b/src/core/endpt.c @@ -111,7 +111,7 @@ nni_endpt_connect(nni_endpt *ep, nni_pipe **pp) } rv = ep->ep_ops.ep_connect(ep->ep_data, &pipe->p_trandata); if (rv != 0) { - nni_pipe_destroy(pipe); + nni_pipe_close(pipe); return (rv); } ep->ep_pipe = pipe; @@ -179,6 +179,7 @@ nni_dialer(void *arg) break; case NNG_ECLOSED: return; + default: // XXX: THIS NEEDS TO BE A PROPER BACKOFF. cooldown = 1000000; @@ -265,7 +266,7 @@ nni_endpt_accept(nni_endpt *ep, nni_pipe **pp) return (rv); } if ((rv = ep->ep_ops.ep_accept(ep->ep_data, &pipe->p_trandata)) != 0) { - nni_pipe_destroy(pipe); + nni_pipe_close(pipe); return (rv); } *pp = pipe; -- cgit v1.2.3-70-g09d2