22 #ifndef NDN_CXX_TRANSPORT_DETAIL_STREAM_TRANSPORT_WITH_RESOLVER_IMPL_HPP
23 #define NDN_CXX_TRANSPORT_DETAIL_STREAM_TRANSPORT_WITH_RESOLVER_IMPL_HPP
33 template<
typename BaseTransport,
typename Protocol>
43 connect(
const typename Protocol::resolver::query& query)
53 this->
m_connectTimer.async_wait([
self = this->shared_from_base()] (
const auto& ec) {
54 self->connectTimeoutHandler(ec);
57 auto resolver = make_shared<typename Protocol::resolver>(this->
m_socket
58 #
if BOOST_VERSION >= 107000
64 resolver->async_resolve(query, [
self = this->shared_from_base(), resolver] (
auto&&... args) {
65 self->resolveHandler(std::forward<decltype(args)>(args)..., resolver);
72 typename Protocol::resolver::iterator endpoint,
73 const shared_ptr<typename Protocol::resolver>&)
76 if (error == boost::system::errc::operation_canceled)
82 typename Protocol::resolver::iterator end;
83 if (endpoint == end) {
88 this->
m_socket.async_connect(*endpoint, [
self = this->shared_from_base()] (
const auto& ec) {
89 self->connectHandler(ec);
99 return static_pointer_cast<Impl>(this->shared_from_this());
Implementation detail of a Boost.Asio-based stream-oriented transport.
Protocol::socket m_socket
boost::asio::steady_timer m_connectTimer
BaseTransport & m_transport
Implementation detail of a Boost.Asio-based stream-oriented transport with resolver support.
StreamTransportWithResolverImpl(BaseTransport &transport, boost::asio::io_service &ioService)
void resolveHandler(const boost::system::error_code &error, typename Protocol::resolver::iterator endpoint, const shared_ptr< typename Protocol::resolver > &)
void connect(const typename Protocol::resolver::query &query)
boost::chrono::seconds seconds