示例#1
0
void Session::internal_on_add(Host::Ptr host, bool is_initial_connection) {
  // Verify that the host is still available
  if (host->is_down()) return;

  if (config().load_balancing_policy()->distance(host) == CASS_HOST_DISTANCE_IGNORE) {
    return;
  }

  if (is_initial_connection) {
    pending_pool_count_ += io_workers_.size();
  } else {
    config().load_balancing_policy()->on_add(host);
  }

  for (IOWorkerVec::iterator it = io_workers_.begin(),
       end = io_workers_.end(); it != end; ++it) {
    (*it)->add_pool_async(host, is_initial_connection);
  }
}
示例#2
0
void Session::internal_on_up(Host::Ptr host) {
  // Verify that the host is still available
  if (host->is_down()) return;

  if (config().load_balancing_policy()->distance(host) == CASS_HOST_DISTANCE_IGNORE) {
    return;
  }

  config().load_balancing_policy()->on_up(host);

  for (IOWorkerVec::iterator it = io_workers_.begin(),
       end = io_workers_.end(); it != end; ++it) {
    (*it)->add_pool_async(host, false);
  }

  config().load_balancing_policy()->on_up(host);

  for (IOWorkerVec::iterator it = io_workers_.begin(),
       end = io_workers_.end(); it != end; ++it) {
    (*it)->add_pool_async(host, false);
  }
}