From a02b1c7040c77f2549bfee16af36688f6b20ae63 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 7 Dec 2024 09:49:07 -0800 Subject: [PATCH] aio: do not reschedule or start operations when expire queue is exiting 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. --- src/core/aio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/aio.c b/src/core/aio.c index e1e9c42fa..91b5c85ab 100644 --- a/src/core/aio.c +++ b/src/core/aio.c @@ -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; @@ -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);