本文整理汇总了C++中host::Ptr::address方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::address方法的具体用法?C++ Ptr::address怎么用?C++ Ptr::address使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类host::Ptr
的用法示例。
在下文中一共展示了Ptr::address方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: is_valid_host
bool BlacklistPolicy::is_valid_host(const Host::Ptr& host) const {
const std::string& host_address = host->address().to_string(false);
for (ContactPointList::const_iterator it = hosts_.begin(),
end = hosts_.end();
it != end; ++it) {
if (host_address.compare(*it) == 0) {
return false;
}
}
return true;
}
示例2:
SharedRefPtr<Host> HostTargetingPolicy::HostTargetingQueryPlan::compute_next() {
if (first_) {
first_ = false;
return preferred_host_;
} else {
Host::Ptr next = child_plan_->compute_next();
if (next && next->address() == preferred_host_->address()) {
return child_plan_->compute_next();
}
return next;
}
}
示例3: on_remove
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);
}
}
示例4: on_add
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
}