Skip to content

Commit

Permalink
sockfd: check the result of nni_aio_schedule
Browse files Browse the repository at this point in the history
This fixes a possible failure condition on teardown.
  • Loading branch information
gdamore committed Dec 4, 2024
1 parent d017a6a commit 397b500
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/sockfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);

Check warning on line 127 in src/core/sockfd.c

View check run for this annotation

Codecov / codecov/patch

src/core/sockfd.c#L127

Added line #L127 was not covered by tests
} else {
nni_aio_schedule(aio, sfd_cancel_accept, l);
nni_aio_list_append(&l->accept_q, aio);
}
nni_mtx_unlock(&l->mtx);
Expand Down

0 comments on commit 397b500

Please sign in to comment.