mirror of
https://github.com/transmission/transmission
synced 2024-12-26 09:37:56 +00:00
perf: tell curl_share to share everything (#2802)
This commit is contained in:
parent
791f59e8ba
commit
6db3fbfe64
1 changed files with 22 additions and 0 deletions
|
@ -116,6 +116,8 @@ public:
|
|||
tr_free(bundle);
|
||||
}
|
||||
|
||||
shareEverything();
|
||||
|
||||
if (curl_ssl_verify)
|
||||
{
|
||||
auto const* bundle = std::empty(curl_ca_bundle) ? "none" : curl_ca_bundle.c_str();
|
||||
|
@ -535,6 +537,26 @@ private:
|
|||
return curlsh_.get();
|
||||
}
|
||||
|
||||
void shareEverything()
|
||||
{
|
||||
// Tell curl to share whatever it can.
|
||||
// https://curl.se/libcurl/c/CURLSHOPT_SHARE.html
|
||||
//
|
||||
// The user's system probably has a different version of curl than
|
||||
// we're compiling with; so instead of listing fields by name, just
|
||||
// loop until curl says we've exhausted the list.
|
||||
|
||||
auto* const sh = shared();
|
||||
for (long type = CURL_LOCK_DATA_COOKIE;; ++type)
|
||||
{
|
||||
if (curl_share_setopt(sh, CURLSHOPT_SHARE, type) != CURLSHE_OK)
|
||||
{
|
||||
tr_logAddDebug(fmt::format("CURLOPT_SHARE ended at {}", type));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static std::once_flag curl_init_flag;
|
||||
|
||||
bool is_closed_ = false;
|
||||
|
|
Loading…
Reference in a new issue