Skip to content

Commit

Permalink
GH-1858 Post to executor to ensure execution on resolver strand
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Nov 6, 2023
1 parent 9ebab22 commit 8da4c46
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/trx_generator/http_client_async.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ class session : public std::enable_shared_from_this<session> {
req_.prepare_payload();

// Look up the domain name
resolver_.async_resolve(
host, std::to_string(port), [self = this->shared_from_this()](beast::error_code ec, auto res) { self->on_resolve(ec, res); });
boost::asio::post( resolver_.get_executor(), [host, port, self=this->shared_from_this()] {
self->resolver_.async_resolve(
host, std::to_string(port), [self](beast::error_code ec, auto res) { self->on_resolve(ec, res); });
});
}

void on_resolve(beast::error_code ec, tcp::resolver::results_type results) {
Expand Down

0 comments on commit 8da4c46

Please sign in to comment.