From ce40ef41046158658939ca6bc476aac4ecae950a Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 19 Mar 2017 21:28:35 -0700 Subject: More cleanups. Delete unused call, isolate ep list creation. --- src/core/socket.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) (limited to 'src/core/socket.c') diff --git a/src/core/socket.c b/src/core/socket.c index 76843174..b285de85 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -94,7 +94,9 @@ nni_sock_hold_close(nni_sock **sockp, uint32_t id) sock->s_id = 0; sock->s_closed = 1; nni_mtx_unlock(nni_idlock); + nni_sock_shutdown(sock); + nni_mtx_lock(nni_idlock); while (sock->s_refcnt != 0) { nni_cv_wait(&sock->s_refcv); @@ -106,28 +108,6 @@ nni_sock_hold_close(nni_sock **sockp, uint32_t id) } -// nni_sock_held_close uses an existing hold on the socket, but is -// otherwise pretty much the same as nni_sock_hold_close. When this -// returns there will be no other user-land references to the socket. -void -nni_sock_held_close(nni_sock *sock) -{ - nni_mtx_lock(nni_idlock); - sock->s_closed = 1; - if (sock->s_id != 0) { - nni_idhash_remove(nni_sockets, sock->s_id); - sock->s_id = 0; - } - nni_mtx_unlock(nni_idlock); - nni_sock_shutdown(sock); - nni_mtx_lock(nni_idlock); - while (sock->s_refcnt != 0) { - nni_cv_wait(&sock->s_refcv); - } - nni_mtx_unlock(nni_idlock); -} - - int nni_sock_pipe_add(nni_sock *sock, nni_pipe *pipe) { @@ -419,7 +399,8 @@ nni_sock_open(nni_sock **sockp, uint16_t pnum) nni_pipe_sock_list_init(&sock->s_pipes); nni_pipe_sock_list_init(&sock->s_idles); - NNI_LIST_INIT(&sock->s_eps, nni_ep, ep_node); + nni_ep_list_init(&sock->s_eps); + sock->s_send_fd.sn_init = 0; sock->s_recv_fd.sn_init = 0; -- cgit v1.2.3-70-g09d2