Beispiel #1
0
void Session::on_up(Host::Ptr host) {
  host->set_up(); // Set the host as up immediately (to avoid duplicate actions)

  if (!prepare_host(host, on_prepare_host_up)) {
    internal_on_up(host);
  }
}
Beispiel #2
0
void Session::on_add(Host::Ptr host, bool is_initial_connection) {
  host->set_up(); // Set the host as up immediately (to avoid duplicate actions)

#if UV_VERSION_MAJOR >= 1
  if (config_.use_hostname_resolution() && host->hostname().empty()) {
    NameResolver::resolve(loop(),
                          host->address(),
                          ResolveNameData(this, host, is_initial_connection),
                          on_add_resolve_name, config_.resolve_timeout_ms());
  } else {
#endif
    // There won't be any prepared statements on the initial connection
    if (is_initial_connection ||
        !prepare_host(host, on_prepare_host_add)) {
      internal_on_add(host, is_initial_connection);
    }
#if UV_VERSION_MAJOR >= 1
  }
#endif
}