Exemplo n.º 1
0
void Session::on_resolve_name(MultiResolver<Session*>::NameResolver* resolver) {
  Session* session = resolver->data()->data();
  if (resolver->is_success()) {
    Host::Ptr host = session->add_host(resolver->address());
    host->set_hostname(resolver->hostname());
  } else if (resolver->is_timed_out()) {
    LOG_ERROR("Timed out attempting to resolve hostname for host %s\n",
              resolver->address().to_string().c_str());
  } else {
    LOG_ERROR("Unable to resolve hostname for host %s\n",
              resolver->address().to_string().c_str());
  }
}
Exemplo n.º 2
0
void Session::on_resolve(MultiResolver<Session*>::Resolver* resolver) {
  Session* session = resolver->data()->data();
  if (resolver->is_success()) {
    AddressVec addresses = resolver->addresses();
    for (AddressVec::iterator it = addresses.begin(); it != addresses.end(); ++it) {
      Host::Ptr host = session->add_host(*it);
      host->set_hostname(resolver->hostname());
    }
  } else if (resolver->is_timed_out()) {
    LOG_ERROR("Timed out attempting to resolve address for %s:%d\n",
              resolver->hostname().c_str(), resolver->port());
  } else {
    LOG_ERROR("Unable to resolve address for %s:%d\n",
              resolver->hostname().c_str(), resolver->port());
  }
}