summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaylin <64823539+JaylinYu@users.noreply.github.com>2025-04-14 17:37:46 +0800
committerGarrett D'Amore <garrett@damore.org>2025-04-27 09:04:39 -0700
commit25bcecade21f1585e04bf2e34fa6433b89fcea2d (patch)
tree1c99cf811d66a237ad20143af242fa31fc2f0ceb
parent41f4f36cb5c28b16c3b8a6d89a93c0955433b984 (diff)
downloadnng-25bcecade21f1585e04bf2e34fa6433b89fcea2d.tar.gz
nng-25bcecade21f1585e04bf2e34fa6433b89fcea2d.tar.bz2
nng-25bcecade21f1585e04bf2e34fa6433b89fcea2d.zip
* FIX [HTTP] fix a blocking case when freeing http client
This is a bug I found in the past 2 days. Easily reproduce with low number of taskq_threads and set small timeout duration to http connect aio.
-rw-r--r--src/supplemental/http/http_client.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/supplemental/http/http_client.c b/src/supplemental/http/http_client.c
index b156794c..b6a70015 100644
--- a/src/supplemental/http/http_client.c
+++ b/src/supplemental/http/http_client.c
@@ -168,13 +168,11 @@ http_dial_cancel(nni_aio *aio, void *arg, int rv)
{
nni_http_client *c = arg;
nni_mtx_lock(&c->mtx);
+ nni_aio_abort(c->aio, rv);
if (nni_aio_list_active(aio)) {
nni_aio_list_remove(aio);
nni_aio_finish_error(aio, rv);
}
- if (nni_list_empty(&c->aios)) {
- nni_aio_abort(c->aio, rv);
- }
nni_mtx_unlock(&c->mtx);
}