Exemplo n.º 1
0
void Session::on_remove(Host::Ptr host) {
  host->set_down();

  config().load_balancing_policy()->on_remove(host);
  { // Lock hosts
    ScopedMutex l(&hosts_mutex_);
    hosts_.erase(host->address());
  }
  for (IOWorkerVec::iterator it = io_workers_.begin(),
       end = io_workers_.end(); it != end; ++it) {
    (*it)->remove_pool_async(host, true);
  }
}
Exemplo n.º 2
0
void Session::on_down(Host::Ptr host) {
  host->set_down();
  config().load_balancing_policy()->on_down(host);

  bool cancel_reconnect = false;
  if (config().load_balancing_policy()->distance(host) == CASS_HOST_DISTANCE_IGNORE) {
    // This permanently removes a host from all IO workers by stopping
    // any attempt to reconnect to that host.
    cancel_reconnect = true;
  }
  for (IOWorkerVec::iterator it = io_workers_.begin(),
       end = io_workers_.end(); it != end; ++it) {
    (*it)->remove_pool_async(host, cancel_reconnect);
  }
}