Skip to content

Commit 6d9ca86

Browse files
committed
make run() post to sessions' executor; rename to async_connect
1 parent 3765fcb commit 6d9ca86

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ void StreamingDataSource::Start() {
163163
kCouldNotParseEndpoint);
164164
return;
165165
}
166-
client_->run();
166+
client_->async_connect();
167167
}
168168

169169
void StreamingDataSource::ShutdownAsync(std::function<void()> completion) {

libs/server-sent-events/include/launchdarkly/sse/client.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ class Builder {
160160
class Client {
161161
public:
162162
virtual ~Client() = default;
163-
virtual void run() = 0;
163+
virtual void async_connect() = 0;
164164
virtual void async_shutdown(std::function<void()> completion) = 0;
165165
};
166166

libs/server-sent-events/src/client.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,16 @@ class FoxyClient : public Client,
175175
if (ec == boost::asio::error::operation_aborted) {
176176
return;
177177
}
178-
run();
178+
do_run();
179179
}
180180

181-
void run() override {
181+
void async_connect() override {
182+
boost::asio::post(
183+
session_->get_executor(),
184+
beast::bind_front_handler(&FoxyClient::do_run, shared_from_this()));
185+
}
186+
187+
void do_run() {
182188
session_->async_connect(
183189
host_, port_,
184190
beast::bind_front_handler(&FoxyClient::on_connect,

0 commit comments

Comments
 (0)