Пример #1
0
  void
  onResolveSuccess(const boost::system::error_code& error,
                   BoostResolver::iterator remoteEndpoint,
                   const shared_ptr<Resolver>& self)
  {
    m_scheduler.cancelEvent(m_resolveTimeout);

    if (error)
      {
        if (error == boost::system::errc::operation_canceled)
          {
            return;
          }

        return m_onError("Remote endpoint hostname or port cannot be resolved: " +
                         error.category().message(error.value()));
      }

    BoostResolver::iterator end;
    for (; remoteEndpoint != end; ++remoteEndpoint)
      {
        IpAddress address(EndPoint(*remoteEndpoint).address());

        if (m_addressSelector(address))
          {
            return m_onSuccess(address);
          }
      }

    m_onError("No endpoint matching the specified address selector found");
  }
Пример #2
0
  void
  onResolveSuccess(const boost::system::error_code& error,
                   typename resolver::iterator remoteEndpoint,
                   const shared_ptr<Resolver>& self)
  {
    scheduler::cancel(m_resolveTimeout);

    if (error)
      {
        if (error == boost::system::errc::operation_canceled)
          return;

        return m_onError("Remote endpoint hostname or port cannot be resolved: " +
                         error.category().message(error.value()));
      }

    typename resolver::iterator end;
    for (; remoteEndpoint != end; ++remoteEndpoint)
      {
        if (m_addressSelector(typename Protocol::endpoint(*remoteEndpoint).address()))
          return m_onSuccess(*remoteEndpoint);
      }

    m_onError("No endpoint matching the specified address selector found");
  }
Пример #3
0
    iterator
    selectAddress(iterator it) const
    {
        while (it != iterator() &&
                !m_addressSelector(it->endpoint().address())) {
            ++it;
        }

        return it;
    }