本文整理汇总了C++中Owned::endpoint方法的典型用法代码示例。如果您正苦于以下问题:C++ Owned::endpoint方法的具体用法?C++ Owned::endpoint怎么用?C++ Owned::endpoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Owned
的用法示例。
在下文中一共展示了Owned::endpoint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doSwap
bool doSwap(const char *oldip, const char *newip)
{
Owned<INode> newNode = createINode(newip);
Owned<INode> oldNode = createINode(oldip);
if (!group->isMember(oldNode)) {
ERRLOG("Node %s is not part of group %s", oldip, groupName.get());
return false;
}
if (group->isMember(newNode)) {
ERRLOG("Node %s is already part of group %s", newip, groupName.get());
return false;
}
queryNamedGroupStore().swapNode(oldNode->endpoint(),newNode->endpoint());
return true;
}
示例2: processMessage
void processMessage(CMessageBuffer &mb)
{
ICoven &coven=queryCoven();
SessionId id;
int fn;
mb.read(fn);
switch (fn) {
case MSR_REGISTER_PROCESS_SESSION: {
acceptConnections.wait();
acceptConnections.signal();
Owned<INode> node(deserializeINode(mb));
Owned<INode> servernode(deserializeINode(mb)); // hopefully me, but not if forwarded
int role=0;
if (mb.length()-mb.getPos()>=sizeof(role)) { // a capability block present
mb.read(role);
if (!manager.authorizeConnection(role,false)) {
SocketEndpoint sender = mb.getSender();
mb.clear();
coven.reply(mb);
MilliSleep(100+getRandom()%1000); // Causes client to 'work' for a short time.
Owned<INode> node = createINode(sender);
coven.disconnect(node);
break;
}
#ifdef _DEBUG
StringBuffer eps;
PROGLOG("Connection to %s authorized",mb.getSender().getUrlStr(eps).str());
#endif
}
IGroup *covengrp;
id = manager.registerClientProcess(node.get(),covengrp,(DaliClientRole)role);
mb.clear().append(id);
if (covengrp->rank(servernode)==RANK_NULL) { // must have been redirected
covengrp->Release(); // no good, so just use one we know about (may use something more sophisticated later)
INode *na = servernode.get();
covengrp = createIGroup(1, &na);
}
covengrp->serialize(mb);
covengrp->Release();
coven.reply(mb);
}
break;
case MSR_SECONDARY_REGISTER_PROCESS_SESSION: {
mb.read(id);
Owned<INode> node (deserializeINode(mb));
int role;
mb.read(role);
manager.addProcessSession(id,node.get(),(DaliClientRole)role);
mb.clear();
coven.reply(mb);
}
break;
case MSR_REGISTER_SESSION: {
SecurityToken tok;
SessionId parentid;
mb.read(tok).read(parentid);
SessionId id = manager.registerSession(tok,parentid);
mb.clear().append(id);
coven.reply(mb);
}
break;
case MSR_SECONDARY_REGISTER_SESSION: {
mb.read(id);
manager.addSession(id);
mb.clear();
coven.reply(mb);
}
break;
case MSR_LOOKUP_PROCESS_SESSION: {
// looks up from node or from id
Owned<INode> node (deserializeINode(mb));
if (node->endpoint().isNull()&&(mb.length()-mb.getPos()>=sizeof(id))) {
mb.read(id);
INode *n = manager.getProcessSessionNode(id);
if (n)
node.setown(n);
node->serialize(mb.clear());
}
else {
id = manager.lookupProcessSession(node.get());
mb.clear().append(id);
}
coven.reply(mb);
}
break;
case MSR_STOP_SESSION: {
SessionId sessid;
bool failed;
mb.read(sessid).read(failed);
manager.stopSession(sessid,failed);
mb.clear();
coven.reply(mb);
}
break;
case MSR_LOOKUP_LDAP_PERMISSIONS: {
StringAttr key;
StringAttr obj;
Owned<IUserDescriptor> udesc=createUserDescriptor();
StringAttr username;
//.........这里部分代码省略.........