Skip to content

Commit 02faae9

Browse files
committed
address review feedback. Move shared pointers in explicit constructor of HttpSessionData
1 parent aaa8dc5 commit 02faae9

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_client.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,10 @@ class OtlpHttpClient
237237
HttpSessionData() = default;
238238

239239
explicit HttpSessionData(
240-
std::shared_ptr<opentelemetry::ext::http::client::Session> input_session,
241-
std::shared_ptr<opentelemetry::ext::http::client::EventHandler> input_handle)
242-
{
243-
session.swap(input_session);
244-
event_handle.swap(input_handle);
245-
}
240+
std::shared_ptr<opentelemetry::ext::http::client::Session> &&input_session,
241+
std::shared_ptr<opentelemetry::ext::http::client::EventHandler> &&input_handle)
242+
: session(std::move(input_session)), event_handle(std::move(input_handle))
243+
{}
246244
};
247245

248246
/**

exporters/otlp/src/otlp_http_client.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,8 +1000,9 @@ OtlpHttpClient::createSession(
10001000

10011001
// Returns the created session data
10021002
return HttpSessionData{
1003-
session, std::shared_ptr<opentelemetry::ext::http::client::EventHandler>{
1004-
new ResponseHandler(std::move(result_callback), options_.console_debug)}};
1003+
std::move(session),
1004+
std::shared_ptr<opentelemetry::ext::http::client::EventHandler>{
1005+
new ResponseHandler(std::move(result_callback), options_.console_debug)}};
10051006
}
10061007

10071008
void OtlpHttpClient::addSession(HttpSessionData &&session_data) noexcept

0 commit comments

Comments
 (0)