22 #ifndef NDN_TRANSPORT_STREAM_TRANSPORT_WITH_RESOLVER_IMPL_HPP 23 #define NDN_TRANSPORT_STREAM_TRANSPORT_WITH_RESOLVER_IMPL_HPP 32 template<
typename BaseTransport,
typename Protocol>
44 connect(
const typename Protocol::resolver::query& query)
54 this->
m_connectTimer.expires_from_now(boost::posix_time::seconds(4));
58 auto resolver = make_shared<typename Protocol::resolver>(ref(this->
m_socket.get_io_service()));
59 resolver->async_resolve(query, bind(&
Impl::resolveHandler, this->shared_from_base(), _1, _2, resolver));
66 const shared_ptr<typename Protocol::resolver>&)
69 if (error == boost::system::errc::operation_canceled)
72 BOOST_THROW_EXCEPTION(
Transport::Error(error,
"Error during resolution of host or port"));
76 if (endpoint == end) {
78 BOOST_THROW_EXCEPTION(
Transport::Error(error,
"Unable to resolve because host or port"));
88 return static_pointer_cast<Impl>(this->shared_from_this());
95 #endif // NDN_TRANSPORT_STREAM_TRANSPORT_WITH_RESOLVER_IMPL_HPP
void connectTimeoutHandler(const boost::system::error_code &error)
Copyright (c) 2011-2015 Regents of the University of California.
BaseTransport & m_transport
implementation detail of a Boost.Asio-based stream-oriented transport
Table::const_iterator iterator
void connect(const typename Protocol::resolver::query &query)
implementation detail of a Boost.Asio-based stream-oriented transport with resolver support ...
void resolveHandler(const boost::system::error_code &error, typename Protocol::resolver::iterator endpoint, const shared_ptr< typename Protocol::resolver > &)
Protocol::socket m_socket
StreamTransportWithResolverImpl< BaseTransport, Protocol > Impl
boost::asio::deadline_timer m_connectTimer
void connectHandler(const boost::system::error_code &error)
StreamTransportWithResolverImpl(BaseTransport &transport, boost::asio::io_service &ioService)