On Saturday 07 of March 2009 07:10:02 Dan Fandrich wrote:
> libcurl keeps a cache of open connections to servers that it reuses when
> possible. Those connections are closed when curl_global_cleanup is called.
> Also, reinitializing libcurl (with curl_global_init) can be expensive, and
> this patch will cause it to be done for every single easy handle when only
> one is used at a time.

Thanks to the counter, the patch has *no* performance impact if you call 
curl_global_init/curl_global_cleanup correctly from the application. Look at 
the current (unpatched) solution:
if(!initialized) {
  res = curl_global_init(CURL_GLOBAL_DEFAULT);
  // ...
}

The value of 'initialized' is dependent on the order of call 
curl_global_init/curl_easy_init from the application. The information about 
this order is lost.

Well, it works fine if you call curl_global_init and then curl_easy_init.
But look at src/main.c - this is not the case. The value of 'initialized'
is 2 after curl_global_init call. Then it never becomes zero and there is
no cleanup. That's not what we need, is it?


Kamil

Reply via email to