diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-12-03 23:26:03 -0500 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-12-03 23:26:03 -0500 |
| commit | 397b5006b76fe6390a48db4a753857a6f2e4d173 (patch) | |
| tree | 2a2c31ac13881e4e882c8f81895ddea653740bf8 /src | |
| parent | d017a6af12dcf9660f7acc149c0a809a7247aa9c (diff) | |
| download | nng-397b5006b76fe6390a48db4a753857a6f2e4d173.tar.gz nng-397b5006b76fe6390a48db4a753857a6f2e4d173.tar.bz2 nng-397b5006b76fe6390a48db4a753857a6f2e4d173.zip | |
sockfd: check the result of nni_aio_schedule
This fixes a possible failure condition on teardown.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/sockfd.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/core/sockfd.c b/src/core/sockfd.c index edf8e0c2..cedd7436 100644 --- a/src/core/sockfd.c +++ b/src/core/sockfd.c @@ -109,6 +109,7 @@ static void sfd_listener_accept(void *arg, nng_aio *aio) { sfd_listener *l = arg; + int rv; if (nni_aio_begin(aio) != 0) { return; @@ -122,8 +123,9 @@ sfd_listener_accept(void *arg, nng_aio *aio) if (l->listen_cnt) { sfd_start_conn(l, aio); + } else if ((rv = nni_aio_schedule(aio, sfd_cancel_accept, l)) != 0) { + nni_aio_finish_error(aio, rv); } else { - nni_aio_schedule(aio, sfd_cancel_accept, l); nni_aio_list_append(&l->accept_q, aio); } nni_mtx_unlock(&l->mtx); |
