Skip to content

Commit

Permalink
windows ipc: check the return value of nni_aio_schedule
Browse files Browse the repository at this point in the history
This hopefully addresses a long standing bug with Windows IPC sometimes
hanging on shut down.
  • Loading branch information
gdamore committed Dec 4, 2024
1 parent ec714f0 commit d017a6a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/platform/windows/win_ipclisten.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ static void
ipc_listener_accept(void *arg, nni_aio *aio)
{
ipc_listener *l = arg;
int rv;
if (nni_aio_begin(aio) != 0) {
return;
}
Expand All @@ -266,10 +267,13 @@ ipc_listener_accept(void *arg, nni_aio *aio)
nni_aio_finish_error(aio, NNG_ESTATE);
return;
}
nni_aio_schedule(aio, ipc_accept_cancel, l);
nni_list_append(&l->aios, aio);
if (nni_list_first(&l->aios) == aio) {
ipc_accept_start(l);
if ((rv = nni_aio_schedule(aio, ipc_accept_cancel, l)) != 0) {
nni_aio_finish_error(aio, rv);
} else {
nni_list_append(&l->aios, aio);
if (nni_list_first(&l->aios) == aio) {
ipc_accept_start(l);
}
}
nni_mtx_unlock(&l->mtx);
}
Expand Down

0 comments on commit d017a6a

Please sign in to comment.