From adcf5754ae8de4dea0c10c327cda01b22f9ffc98 Mon Sep 17 00:00:00 2001 From: Or Ozeri Date: Thu, 1 Mar 2018 13:21:27 +0200 Subject: [PATCH] cleanup failing curl handles on retries --- src/curl.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/curl.cpp b/src/curl.cpp index 09717f3..ceb0a63 100644 --- a/src/curl.cpp +++ b/src/curl.cpp @@ -1762,7 +1762,9 @@ bool S3fsCurl::DestroyCurlHandle(void) S3fsCurl::curl_times.erase(hCurl); S3fsCurl::curl_progress.erase(hCurl); - sCurlPool->ReturnHandler(hCurl); + if(retry_count == 0){ + sCurlPool->ReturnHandler(hCurl); + } hCurl = NULL; ClearInternalData(); @@ -1872,7 +1874,12 @@ bool S3fsCurl::RemakeHandle(void) partdata.size = b_partdata_size; // reset handle + curl_easy_cleanup(hCurl); + hCurl = curl_easy_init(); ResetHandle(); + // disable ssl cache, so that a new session will be created + curl_easy_setopt(hCurl, CURLOPT_SSL_SESSIONID_CACHE, 0); + curl_easy_setopt(hCurl, CURLOPT_SHARE, NULL); // set options switch(type){