diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-03-19 21:28:35 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-03-19 21:28:35 -0700 |
| commit | ce40ef41046158658939ca6bc476aac4ecae950a (patch) | |
| tree | 45cd097e1026aa7a5bdcc5b0465db98a2ddd1aff /src/core/socket.c | |
| parent | 6fa1e01e750ea09292b21318c3fba33df40eaac0 (diff) | |
| download | nng-ce40ef41046158658939ca6bc476aac4ecae950a.tar.gz nng-ce40ef41046158658939ca6bc476aac4ecae950a.tar.bz2 nng-ce40ef41046158658939ca6bc476aac4ecae950a.zip | |
More cleanups. Delete unused call, isolate ep list creation.
Diffstat (limited to 'src/core/socket.c')
| -rw-r--r-- | src/core/socket.c | 27 |
1 files changed, 4 insertions, 23 deletions
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; |
