From e81219db592d4f1622710136a11b8e8c4fe36c79 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Tue, 7 Aug 2018 05:38:42 +0300 Subject: fixes #625 aio->a_stop/aio_begin may be too severe --- src/core/aio.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') 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; -- cgit v1.2.3-70-g09d2