Skip to content

Commit f0e5037

Browse files
authored
revert: 290cc27 (#229)
Commit `290cc278` introduced a concurrency issue when cleaning requests in-flight.
1 parent 105e421 commit f0e5037

File tree

3 files changed

+1
-29
lines changed

3 files changed

+1
-29
lines changed

src/datadog/curl.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
#include <chrono>
1212
#include <condition_variable>
1313
#include <cstddef>
14-
#include <iterator>
1514
#include <list>
1615
#include <memory>
1716
#include <mutex>
1817
#include <system_error>
1918
#include <unordered_map>
2019
#include <unordered_set>
2120

21+
#include "json.hpp"
2222
#include "string_util.h"
2323

2424
namespace datadog {
@@ -428,7 +428,6 @@ void CurlImpl::drain(std::chrono::steady_clock::time_point deadline) {
428428
});
429429

430430
log_on_error(curl_.multi_wakeup(multi_handle_));
431-
clear_requests();
432431
}
433432

434433
std::size_t CurlImpl::on_read_header(char *data, std::size_t,

src/datadog/curl.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#include <string>
2020
#include <thread>
2121

22-
#include "json.hpp"
23-
2422
namespace datadog {
2523
namespace tracing {
2624

test/test_curl.cpp

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -156,31 +156,6 @@ const auto ignore = [](auto &&...) {};
156156

157157
using namespace std::chrono_literals;
158158

159-
CURL_TEST("API") {
160-
const auto clock = default_clock;
161-
const auto logger = std::make_shared<MockLogger>();
162-
SingleRequestMockCurlLibrary library;
163-
const auto client = std::make_shared<Curl>(logger, clock, library);
164-
165-
SECTION("drain remove requests in-flight") {
166-
/// Prevent to process the request.
167-
library.on_multi_perform = [] { return CURLM_OK; };
168-
169-
const HTTPClient::URL url = {"http", "whatever", ""};
170-
171-
const auto result = client->post(url, ignore, "whatever", ignore, ignore,
172-
clock().tick + 60min);
173-
174-
REQUIRE(result);
175-
REQUIRE(library.created_handles_.size() == 1);
176-
REQUIRE(library.destroyed_handles_.size() == 0);
177-
178-
client->drain(clock().tick + 1s);
179-
CHECK(library.created_handles_.size() == 1);
180-
CHECK(library.destroyed_handles_.size() == 1);
181-
}
182-
}
183-
184159
CURL_TEST("parse response headers and body") {
185160
const auto clock = default_clock;
186161
const auto logger = std::make_shared<MockLogger>();

0 commit comments

Comments
 (0)