On Tue, 25 Jul 2017, Marcin Kolny via curl-library wrote:

I'm supporting retry functionality in my application. Currently, every time when I do the request, I'm duplicating the curl handle, and if request fails, I'm repeating the request using duplicated curl handle. So it looks more or less like that:

This works fine, however, I'm wondering if this handle duplication is necessary. Is it safe to re-use curl handle if the previous request has failed?

It is perfectly safe to instead reuse the handle from the previous transfer.

But... when you use the multi API, all the interesting and useful caches are held in the multi handle already and not in the easy handle, so there's a very small cost to duplicate and add the easy handle the way you do it. You're mostly paying for this approach with more more memory management since libcurl will free and malloc the handles each time.

--

 / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to