diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/socket.c | 4 | ||||
| -rw-r--r-- | src/core/socket.h | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/core/socket.c b/src/core/socket.c index 1b4d1585..0ae20a28 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -77,7 +77,7 @@ nni_reaper(void *arg) continue; } - if ((sock->s_closing) && + if ((sock->s_reapexit) && (nni_list_first(&sock->s_reaps) == NULL) && (nni_list_first(&sock->s_pipes) == NULL)) { nni_mtx_unlock(&sock->s_mx); @@ -198,6 +198,7 @@ nni_sock_open(nni_sock **sockp, uint16_t pnum) sock->s_closing = 0; sock->s_reconn = NNI_SECOND; sock->s_reconnmax = NNI_SECOND; + sock->s_reapexit = 0; NNI_LIST_INIT(&sock->s_pipes, nni_pipe, p_node); NNI_LIST_INIT(&sock->s_reaps, nni_pipe, p_node); NNI_LIST_INIT(&sock->s_eps, nni_ep, ep_node); @@ -382,6 +383,7 @@ nni_sock_shutdown(nni_sock *sock) sock->s_sock_ops.sock_close(sock->s_data); + sock->s_reapexit = 1; nni_cv_wake(&sock->s_notify_cv); nni_cv_wake(&sock->s_cv); nni_mtx_unlock(&sock->s_mx); diff --git a/src/core/socket.h b/src/core/socket.h index 424b1321..1743869a 100644 --- a/src/core/socket.h +++ b/src/core/socket.h @@ -49,6 +49,7 @@ struct nng_socket { int s_ep_pend; // EP dial/listen in progress int s_closing; // Socket is closing + int s_reapexit; // Shutdown the reaper int s_besteffort; // Best effort mode delivery int s_senderr; // Protocol state machine use int s_recverr; // Protocol state machine use |
