I use the function async_resolve()
using tcp = boost::asio::ip::tcp;
namespace asio = boost::asio;
template <class Request, class Response>
class HttpsClient : public std::enable_shared_from_this<HttpsClient<Request, Response>>
{
mutable asio::io_context::strand m_strand;
tcp::resolver m_resolver;
const std::string m_host;
const std::string m_service;
void doSend(Request request, Handler handler)
{
...
m_resolver.async_resolve(
m_host, m_service,
asio::bind_executor(
m_strand, std::bind(&HttpsClient::onResolve, this->shared_from_this(), _1, _2)
)
);
...
}
void onResolve(const boost::system::error_code& ec, tcp::resolver::results_type results);
Should I cancel async_resolve()
for example after some timeout? My question is - does async_resolve()
give any guaranties to return in smart time limitations.
Aucun commentaire:
Enregistrer un commentaire