aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/aio.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/core/aio.c b/src/core/aio.c
index 294a0b92..0a9c744d 100644
--- a/src/core/aio.c
+++ b/src/core/aio.c
@@ -344,9 +344,16 @@ nni_aio_begin(nni_aio *aio)
nni_mtx_lock(&nni_aio_lk);
// We should not reschedule anything at this point.
if (aio->a_stop) {
- aio->a_result = NNG_ECLOSED;
+ aio->a_result = NNG_ECANCELED;
+ aio->a_count = 0;
+ nni_list_node_remove(&aio->a_expire_node);
+ aio->a_prov_cancel = NULL;
+ aio->a_expire = NNI_TIME_NEVER;
+ aio->a_sleep = false;
nni_mtx_unlock(&nni_aio_lk);
- return (NNG_ECLOSED);
+
+ nni_task_dispatch(aio->a_task);
+ return (NNG_ECANCELED);
}
aio->a_result = 0;
aio->a_count = 0;