Skip to content

Commit d8e7b1d

Browse files
committed
fix some lints
1 parent 249e147 commit d8e7b1d

File tree

4 files changed

+19
-20
lines changed

4 files changed

+19
-20
lines changed

contract-tests/sse-contract-tests/include/event_outbox.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ class EventOutbox : public std::enable_shared_from_this<EventOutbox> {
7272
private:
7373
RequestType build_request(
7474
std::size_t counter,
75-
std::variant<launchdarkly::sse::Event, launchdarkly::sse::Error> ev);
75+
std::variant<launchdarkly::sse::Event, launchdarkly::sse::Error> event);
7676
void on_resolve(beast::error_code ec, tcp::resolver::results_type results);
7777
void on_connect(beast::error_code ec,
7878
tcp::resolver::results_type::endpoint_type);
7979
void on_flush_timer(boost::system::error_code ec);
8080
void on_write(beast::error_code ec, std::size_t);
81-
void do_shutdown(beast::error_code ec, std::string what);
81+
void do_shutdown(beast::error_code ec);
8282
};

contract-tests/sse-contract-tests/src/entity_manager.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ std::optional<std::string> EntityManager::create(ConfigParams const& params) {
2727
}
2828

2929
if (params.body) {
30-
client_builder.body(std::move(*params.body));
30+
client_builder.body(*params.body);
3131
}
3232

3333
if (params.readTimeoutMs) {
@@ -44,12 +44,13 @@ std::optional<std::string> EntityManager::create(ConfigParams const& params) {
4444
LD_LOG(logger_, LogLevel::kDebug) << std::move(msg);
4545
});
4646

47-
client_builder.receiver([copy = poster](launchdarkly::sse::Event e) {
48-
copy->post_event(std::move(e));
47+
client_builder.receiver([copy = poster](launchdarkly::sse::Event event) {
48+
copy->post_event(std::move(event));
4949
});
5050

51-
client_builder.errors(
52-
[copy = poster](launchdarkly::sse::Error e) { copy->post_error(e); });
51+
client_builder.errors([copy = poster](launchdarkly::sse::Error event) {
52+
copy->post_error(event);
53+
});
5354

5455
auto client = client_builder.build();
5556
if (!client) {

contract-tests/sse-contract-tests/src/event_outbox.cpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ auto const kOutboxCapacity = 1023;
1414
EventOutbox::EventOutbox(net::any_io_executor executor,
1515
std::string callback_url)
1616
: callback_url_{std::move(callback_url)},
17-
callback_port_{},
18-
callback_host_{},
1917
callback_counter_{0},
2018
executor_{executor},
2119
resolver_{executor},
@@ -29,7 +27,7 @@ EventOutbox::EventOutbox(net::any_io_executor executor,
2927
callback_port_ = uri_components->port();
3028
}
3129

32-
void EventOutbox::do_shutdown(beast::error_code ec, std::string what) {
30+
void EventOutbox::do_shutdown(beast::error_code ec) {
3331
event_stream_.socket().shutdown(tcp::socket::shutdown_both, ec);
3432
flush_timer_.cancel();
3533
}
@@ -54,16 +52,14 @@ void EventOutbox::run() {
5452

5553
void EventOutbox::stop() {
5654
beast::error_code ec = net::error::basic_errors::operation_aborted;
57-
std::string reason = "stop";
5855
shutdown_ = true;
59-
net::post(executor_,
60-
beast::bind_front_handler(&EventOutbox::do_shutdown,
61-
shared_from_this(), ec, reason));
56+
net::post(executor_, beast::bind_front_handler(&EventOutbox::do_shutdown,
57+
shared_from_this(), ec));
6258
}
6359

6460
EventOutbox::RequestType EventOutbox::build_request(
6561
std::size_t counter,
66-
std::variant<launchdarkly::sse::Event, launchdarkly::sse::Error> ev) {
62+
std::variant<launchdarkly::sse::Event, launchdarkly::sse::Error> event) {
6763
RequestType req;
6864

6965
req.set(http::field::host, callback_host_);
@@ -101,7 +97,7 @@ EventOutbox::RequestType EventOutbox::build_request(
10197
json = msg;
10298
}
10399
},
104-
std::move(ev));
100+
std::move(event));
105101

106102
req.body() = json.dump();
107103
req.prepare_payload();
@@ -111,7 +107,7 @@ EventOutbox::RequestType EventOutbox::build_request(
111107
void EventOutbox::on_resolve(beast::error_code ec,
112108
tcp::resolver::results_type results) {
113109
if (ec) {
114-
return do_shutdown(ec, "resolve");
110+
return do_shutdown(ec);
115111
}
116112

117113
beast::get_lowest_layer(event_stream_)
@@ -123,7 +119,7 @@ void EventOutbox::on_resolve(beast::error_code ec,
123119
void EventOutbox::on_connect(beast::error_code ec,
124120
tcp::resolver::results_type::endpoint_type) {
125121
if (ec) {
126-
return do_shutdown(ec, "connect");
122+
return do_shutdown(ec);
127123
}
128124

129125
boost::system::error_code dummy;
@@ -133,7 +129,7 @@ void EventOutbox::on_connect(beast::error_code ec,
133129

134130
void EventOutbox::on_flush_timer(boost::system::error_code ec) {
135131
if (ec && shutdown_) {
136-
return do_shutdown(ec, "flush");
132+
return do_shutdown(ec);
137133
}
138134

139135
if (!outbox_.empty()) {
@@ -156,7 +152,7 @@ void EventOutbox::on_flush_timer(boost::system::error_code ec) {
156152

157153
void EventOutbox::on_write(beast::error_code ec, std::size_t) {
158154
if (ec) {
159-
return do_shutdown(ec, "write");
155+
return do_shutdown(ec);
160156
}
161157
outbox_.pop();
162158
on_flush_timer(boost::system::error_code{});

libs/client-sdk/src/data_sources/streaming_data_source.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ static char const* DataSourceErrorToString(launchdarkly::sse::Error error) {
2727
return "server responded with an invalid redirection";
2828
case sse::Error::UnrecoverableClientError:
2929
return "unrecoverable client-side error";
30+
case sse::Error::ReadTimeout:
31+
return "read timeout reached";
3032
}
3133
}
3234

0 commit comments

Comments
 (0)