From e7435097668eb03fc79faab41308349f75fbabf9 Mon Sep 17 00:00:00 2001 From: Mykhailo Kuchma Date: Tue, 10 Mar 2020 14:18:15 +0200 Subject: [PATCH] Revert "Fix a crash in the NetworkCurl. (#701)" (#706) The commit caused a regression, the crash itself is a very exotic case. Crash is added to the known issues. Relates-To: OLPEDGE-1687 This reverts commit 4cdd52dc69811783af1c4067ef825081dc075672. Signed-off-by: Mykhailo Kuchma --- olp-cpp-sdk-core/src/http/curl/NetworkCurl.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/olp-cpp-sdk-core/src/http/curl/NetworkCurl.cpp b/olp-cpp-sdk-core/src/http/curl/NetworkCurl.cpp index 87e65e929..75de186b8 100644 --- a/olp-cpp-sdk-core/src/http/curl/NetworkCurl.cpp +++ b/olp-cpp-sdk-core/src/http/curl/NetworkCurl.cpp @@ -908,6 +908,7 @@ void NetworkCurl::CompleteMessage(CURL* handle, CURLcode result) { return; } + lock.unlock(); std::string error("Success"); int status; if ((result == CURLE_OK) || (result == CURLE_HTTP_RETURNED_ERROR)) { @@ -954,6 +955,7 @@ void NetworkCurl::CompleteMessage(CURL* handle, CURLcode result) { << handles_[index].id << ", url=" << url << " err=(" << status << ") " << error); handles_[index].count = 0; + lock.lock(); events_.emplace_back(EventInfo::Type::SEND_EVENT, &handles_[index]); return; } @@ -966,7 +968,7 @@ void NetworkCurl::CompleteMessage(CURL* handle, CURLcode result) { .WithRequestId(handles_[index].id) .WithStatus(status) .WithError(error); - ReleaseHandleUnlocked(&handles_[index]); + ReleaseHandle(&handles_[index]); callback(response); } else { OLP_SDK_LOG_WARNING(kLogTag, "Complete message to unknown request"); @@ -1076,7 +1078,6 @@ void NetworkCurl::Run() { lock.lock(); } curl_multi_remove_handle(curl_, handles_[handle_index].handle); - ReleaseHandleUnlocked(&handles_[handle_index]); } else { OLP_SDK_LOG_ERROR( kLogTag,