Skip to content

Commit

Permalink
Revert "Fix a crash in the NetworkCurl. (#701)" (#706)
Browse files Browse the repository at this point in the history
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 4cdd52d.

Signed-off-by: Mykhailo Kuchma <ext-mykhailo.kuchma@here.com>
  • Loading branch information
mykhailo-kuchma authored Mar 10, 2020
1 parent b04b657 commit e743509
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions olp-cpp-sdk-core/src/http/curl/NetworkCurl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;
}
Expand All @@ -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");
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit e743509

Please sign in to comment.