diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-01-18 11:26:12 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-01-18 11:26:12 -0800 |
| commit | a1bfa3de91d6fa6134e2d13777ccec2ddf73d1fc (patch) | |
| tree | 390ee6a063f78fdd4e4a661055ab3fc64f35c04c /src | |
| parent | 7a9c328c4fd29fa7ba3dce8c8189384cd855d244 (diff) | |
| download | nng-a1bfa3de91d6fa6134e2d13777ccec2ddf73d1fc.tar.gz nng-a1bfa3de91d6fa6134e2d13777ccec2ddf73d1fc.tar.bz2 nng-a1bfa3de91d6fa6134e2d13777ccec2ddf73d1fc.zip | |
Reaper exits too soon, leaking bits.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/socket.c | 4 | ||||
| -rw-r--r-- | src/core/socket.h | 1 | ||||
| -rw-r--r-- | src/platform/posix/posix_rand.c | 1 |
3 files changed, 5 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 diff --git a/src/platform/posix/posix_rand.c b/src/platform/posix/posix_rand.c index f8986e07..11d166bd 100644 --- a/src/platform/posix/posix_rand.c +++ b/src/platform/posix/posix_rand.c @@ -19,6 +19,7 @@ #include <unistd.h> #include <sys/utsname.h> #include <fcntl.h> +#include <string.h> #ifdef NNG_USE_GETRANDOM #include <linux/random.h> |
