本文整理汇总了C++中Host::name方法的典型用法代码示例。如果您正苦于以下问题:C++ Host::name方法的具体用法?C++ Host::name怎么用?C++ Host::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Host
的用法示例。
在下文中一共展示了Host::name方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: connect
void Server::connect(SocksClientSocket &me, const Host &host, IPPort port)
{
#if 1
//@@@ should be using Hostname (server resolution) mode, but this won't get us
//@@@ any useful peer address to use for bind relaying. Need to rethink this scenario.
set<IPAddress> addrs = host.addresses();
for (set<IPAddress>::const_iterator it = addrs.begin(); it != addrs.end(); it++) {
try {
IPSockAddress addr(*it, port);
connect(me, addr);
return;
} catch (const UnixError &err) {
errno = err.error;
}
}
// exhausted
UnixError::throwMe();
#else
open(me, me);
Message request(socksConnect, host.name().c_str(), port);
request.send(me);
Message reply(me);
me.mLocalAddress = reply.address();
//me.mPeerAddress = not provided by Socks5 protocol;
secdebug("socks", "%d socks connected to %s", me.fd(), host.name().c_str());
#endif
}
示例2: servePendingRequests
void Loader::servePendingRequests(Priority minimumPriority)
{
if (m_isSuspendingPendingRequests)
return;
m_requestTimer.stop();
m_nonHTTPProtocolHost->servePendingRequests(minimumPriority);
Vector<Host*> hostsToServe;
m_hosts.checkConsistency();
HostMap::iterator i = m_hosts.begin();
HostMap::iterator end = m_hosts.end();
for (; i != end; ++i)
hostsToServe.append(i->second.get());
for (unsigned n = 0; n < hostsToServe.size(); ++n) {
Host* host = hostsToServe[n];
if (host->hasRequests())
host->servePendingRequests(minimumPriority);
else if (!host->processingResource()) {
AtomicString name = host->name();
m_hosts.remove(name.impl());
}
}
}
示例3: schedule_tasks
void Master::schedule_tasks() {
log_debug("Scheduling %d tasks on %d slots...",
ready_queue.size(), free_slots.size());
int scheduled = 0;
TaskList deferred_tasks;
while (ready_queue.size() > 0 && free_slots.size() > 0) {
Task *task = ready_queue.top();
ready_queue.pop();
log_trace("Scheduling task %s", task->name.c_str());
bool match = false;
for (SlotList::iterator s = free_slots.begin(); s != free_slots.end(); s++) {
Slot *slot = *s;
Host *host = slot->host;
// If the task fits, schedule it
if (host->can_run(task)) {
log_trace("Matched task %s to slot %d on host %s",
task->name.c_str(), slot->rank, host->name());
// Reserve the resources
vector<cpu_t> bindings = host->allocate_resources(task);
host->log_resources(resource_log);
submit_task(task, slot->rank, bindings);
s = free_slots.erase(s);
// so that the s++ in the loop doesn't skip one
s--;
match = true;
scheduled += 1;
// This is to break out of the slot loop so that we can
// consider the next task
break;
}
}
if (!match) {
// If the task could not be scheduled, then we save it
// and move on to the next one. It will be requeued later.
log_trace("No slot found for task %s", task->name.c_str());
deferred_tasks.push_back(task);
}
}
log_debug("Scheduled %d tasks and deferred %d tasks", scheduled, deferred_tasks.size());
// Requeue all the deferred tasks
for (TaskList::iterator t = deferred_tasks.begin(); t != deferred_tasks.end(); t++) {
ready_queue.push(*t);
}
}
示例4: data
QVariant HostModel::data(const QModelIndex &index, int role) const
{
if (index.row() < 0 || index.row() >= m_hosts.count())
return QVariant();
Host* host = m_hosts.at(index.row());
switch (index.column()) {
case 0: {
switch (role) {
case NameRole: return host->name();
case AddressRole: return host->address();
}
break;
}
case 1: if (role == Qt::DisplayRole) return host->name(); break;
case 2: if (role == Qt::DisplayRole) return host->productVersion(); break;
case 3: if (role == Qt::DisplayRole) return host->systemName(); break;
case 4: if (role == Qt::DisplayRole) return QString("%1:%2").arg(host->address()).arg(host->port()); break;
}
return QVariant();
}
示例5: setHost
void SnafuHostItem::setHost(Host host)
{
mHost = host;
setIcon(0, QIcon( SnafuWidget::statusPixmap(host.status()) ) );
setText(0, host.name());
setText(1, host.os());
setText(2, host.description());
setText(3, host.hostStatus().slaveStatus());
setText(4, host.slavePulse().toString("yyyy.MM.dd hh:mm:ss"));
//setText(5, host.xcatImageVersion);
//setText(6, host.xcatNodeStat);
//setText(7, QString::number(host.taskCount));
//setText(8, QString::number(host.errorCount));
//setText(9, MainWindow::timeCode(host.taskAverageTime));
//setText(10, MainWindow::timeCode(host.taskSuccessTime));
}
示例6: servePendingRequests
void Loader::servePendingRequests(Priority minimumPriority)
{
m_requestTimer.stop();
m_nonHTTPProtocolHost.servePendingRequests(minimumPriority);
Vector<Host*> hostsToServe;
copyValuesToVector(m_hosts, hostsToServe);
for (unsigned n = 0; n < hostsToServe.size(); ++n) {
Host* host = hostsToServe[n];
if (host->hasRequests())
host->servePendingRequests(minimumPriority);
else if (!host->processingResource()){
AtomicString name = host->name();
delete host;
m_hosts.remove(name.impl());
}
}
}