Skip to content

Commit

Permalink
aio: do not reschedule or start operations when expire queue is exiting
Browse files Browse the repository at this point in the history
We do not want to let operations restart if we're in the process of shutting
down.  This ensures that they get a reasonable hard failure.
  • Loading branch information
gdamore committed Dec 7, 2024
1 parent 61869fa commit a02b1c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/aio.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ nni_aio_begin(nni_aio *aio)
aio->a_cancel_fn = NULL;

// We should not reschedule anything at this point.
if (aio->a_stop) {
if (aio->a_stop || eq->eq_exit) {
aio->a_result = NNG_ECANCELED;
aio->a_cancel_fn = NULL;
aio->a_expire = NNI_TIME_NEVER;
Expand Down Expand Up @@ -380,7 +380,7 @@ nni_aio_schedule(nni_aio *aio, nni_aio_cancel_fn cancel, void *data)
}

nni_mtx_lock(&eq->eq_mtx);
if (aio->a_stop) {
if (aio->a_stop || eq->eq_exit) {
nni_task_abort(&aio->a_task);
nni_mtx_unlock(&eq->eq_mtx);
return (NNG_ECLOSED);
Expand Down

0 comments on commit a02b1c7

Please sign in to comment.