diff options
author | Daniel Stenberg <daniel@haxx.se> | 2023-03-26 17:43:28 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2023-03-26 17:43:28 +0200 |
commit | 843b3baa3e3cb2280064626a530bb9e3e2ccbb9b (patch) | |
tree | e6e8eb6226f634d0c5d1c7f7d376a9dfdba426f8 /lib/transfer.c | |
parent | 9d107b6954d5690731f86702105d2e29421f7226 (diff) | |
download | curl-843b3baa3e3cb2280064626a530bb9e3e2ccbb9b.tar.gz |
multi: remove PENDING + MSGSENT handles from the main linked list
As they are not driving transfers or any socket activity, the main loop
does not need to iterate over these handles. A performance improvement.
They are instead only held in their own separate lists.
'data->multi' is kept a pointer to the multi handle as long as the easy
handle is actually part of it even when the handle is moved to the
pending/msgsent lists. It needs to know which multi handle it belongs
to, if for example curl_easy_cleanup() is called before the handle is
removed from the multi handle.
Alll 'data->multi' pointers of handles still part of the multi handle
gets cleared by curl_multi_cleanup() which "orphans" all previously
attached easy handles.
This is take 2. The first version was reverted for the 8.0.1 release.
Assisted-by: Stefan Eissing
Closes #10801
Diffstat (limited to 'lib/transfer.c')
-rw-r--r-- | lib/transfer.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/transfer.c b/lib/transfer.c index a28395233..cb781833f 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -1408,7 +1408,12 @@ CURLcode Curl_pretransfer(struct Curl_easy *data) return CURLE_OUT_OF_MEMORY; } wc = data->wildcard; - if(wc->state < CURLWC_INIT) { + if((wc->state < CURLWC_INIT) || + (wc->state >= CURLWC_CLEAN)) { + if(wc->ftpwc) + wc->dtor(wc->ftpwc); + Curl_safefree(wc->pattern); + Curl_safefree(wc->path); result = Curl_wildcard_init(wc); /* init wildcard structures */ if(result) return CURLE_OUT_OF_MEMORY; |