aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-08-07 05:38:42 +0300
committerGarrett D'Amore <garrett@damore.org>2018-08-07 05:38:42 +0300
commite81219db592d4f1622710136a11b8e8c4fe36c79 (patch)
treeac6b5aa3e3b2347080fe3fd93844fd0616cf9f00
parent1c9d966b0ce3574f0baf16201161f3c68d22c556 (diff)
downloadnng-e81219db592d4f1622710136a11b8e8c4fe36c79.tar.gz
nng-e81219db592d4f1622710136a11b8e8c4fe36c79.tar.bz2
nng-e81219db592d4f1622710136a11b8e8c4fe36c79.zip
fixes #625 aio->a_stop/aio_begin may be too severe
-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;