diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-01-21 17:40:04 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-01-21 17:40:04 -0800 |
| commit | 568a84ed2d3d41da5ca64cde15a677237fffd991 (patch) | |
| tree | 92ee212c0c8f4dc264acd0cef33285bddefd5a93 /src/nng.c | |
| parent | 434cdd9f4e9211b99ba62ff6973e082b90e098f0 (diff) | |
| download | nng-568a84ed2d3d41da5ca64cde15a677237fffd991.tar.gz nng-568a84ed2d3d41da5ca64cde15a677237fffd991.tar.bz2 nng-568a84ed2d3d41da5ca64cde15a677237fffd991.zip | |
Fix leaks in bus, socket leaks, tighten up close-side refcnting.
This does a few things. First it closes some preexisting leaks.
Second it tightens the overall close logic so that we automatically
discard idhash resources (while keeping numeric values for next id
etc. around) when the last socket is closed. This then eliminates
the need for applications to ever explicitly terminate resources.
It turns out platform-specific resources established at nni_init()
time might still be leaked, but it's also the case that we now no
longer dynamically allocate anything at platform initialization time.
(This presumes that the platform doesn't do so under the hood when
creating critical sections or mutexes for example.)
Diffstat (limited to 'src/nng.c')
| -rw-r--r-- | src/nng.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -56,7 +56,9 @@ nng_close(nng_socket sid) int rv; nni_sock *sock; - if ((rv = nni_sock_hold(&sock, sid)) != 0) { + // Close is special, because we still want to be able to get + // a hold on the socket even if shutdown was called. + if ((rv = nni_sock_hold_close(&sock, sid)) != 0) { return (rv); } // No release -- close releases it. @@ -607,3 +609,10 @@ nng_device(nng_socket sock1, nng_socket sock2) // Device TBD. return (NNG_ENOTSUP); } + + +void +nng_usleep(uint64_t usec) +{ + nni_usleep(usec); +} |
