本文整理汇总了C++中GroupPtr::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ GroupPtr::Get方法的具体用法?C++ GroupPtr::Get怎么用?C++ GroupPtr::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GroupPtr
的用法示例。
在下文中一共展示了GroupPtr::Get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReqToBindInnerPort
/**
@brief ReqToBindInnerPort
*/
bool CFarmServer::ReqToBindInnerPort(farm::ReqToBindInnerPort_Packet &packet)
{
GroupPtr pGroup = GetServer()->GetRootGroup().GetChildFromPlayer( packet.senderId );
if (!pGroup)
{// Error!!
clog::Error( log::ERROR_PROBLEM, "ReqToBindInnerPort Error!!, not exist group user id = %d\n", packet.senderId );
m_Protocol.AckToBindOuterPort( packet.senderId, SEND_T, error::ERR_NOT_FOUND_GROUP, packet.bindSubServerSvrType, 0);
return false;
}
SubServerGroupPtr pSubSvrGroup = dynamic_cast<CSubServerGroup*>(pGroup.Get());
if (!pSubSvrGroup)
{// Error!!
clog::Error( log::ERROR_PROBLEM, "ReqToBindInnerPort Error!!, not convert group user id = %d\n", packet.senderId );
m_Protocol.AckToBindOuterPort( packet.senderId, SEND_T, error::ERR_NOT_FOUND_GROUP, packet.bindSubServerSvrType, 0);
return false;
}
const int bindPort = pSubSvrGroup->GetToBindInnerPort( CServerSessionAccess(GetServer()) );
RemoteSubServerPtr pSubServer = dynamic_cast<CRemoteSubServer*>(
GetServer()->GetSession(packet.senderId));
if (!pSubServer)
{// Error!!
clog::Error( log::ERROR_PROBLEM, "ReqToBindInnerPort Error!!, not found user user id = %d\n", packet.senderId );
m_Protocol.AckToBindOuterPort( packet.senderId, SEND_T, error::ERR_NOT_FOUND_USER, packet.bindSubServerSvrType, 0);
return false;
}
pSubServer->SetInnerBindPort( packet.bindSubServerSvrType, bindPort );
m_Protocol.AckToBindInnerPort( packet.senderId, SEND_T, error::ERR_SUCCESS, packet.bindSubServerSvrType, bindPort );
return true;
}
示例2: ReqSubServerBindComplete
/**
@brief ReqSubServerBindComplete
*/
bool CFarmServer::ReqSubServerBindComplete(farm::ReqSubServerBindComplete_Packet &packet)
{
GroupPtr pGroup = GetServer()->GetRootGroup().GetChildFromPlayer( packet.senderId );
if (!pGroup)
{// Error!!
clog::Error( log::ERROR_PROBLEM, "ReqSubServerBindComplete Error!!, not exist group user id = %d\n", packet.senderId );
m_Protocol.AckSubServerBindComplete( packet.senderId, SEND_T, error::ERR_NOT_FOUND_GROUP, packet.bindSubServerSvrType );
return false;
}
SubServerGroupPtr pSubSvrGroup = dynamic_cast<CSubServerGroup*>(pGroup.Get());
if (!pSubSvrGroup)
{// Error!!
clog::Error( log::ERROR_PROBLEM, "ReqSubServerBindComplete Error!!, not convert group user id = %d\n", packet.senderId );
m_Protocol.AckSubServerBindComplete( packet.senderId, SEND_T, error::ERR_NOT_FOUND_GROUP, packet.bindSubServerSvrType );
return false;
}
RemoteSubServerPtr pClient = dynamic_cast<CRemoteSubServer*>(
GetServer()->GetSession(packet.senderId));
if (!pClient)
{
clog::Error( log::ERROR_PROBLEM, "AckSubServerBindComplete Error!!, not exist user id = %d\n", packet.senderId );
m_Protocol.AckSubServerBindComplete( packet.senderId, SEND_T, error::ERR_NOT_FOUND_USER, packet.bindSubServerSvrType );
return false;
}
pClient->SetBindComplete(packet.bindSubServerSvrType);
m_Protocol.AckSubServerBindComplete( packet.senderId, SEND_T, error::ERR_SUCCESS, packet.bindSubServerSvrType );
if (packet.bindSubServerSvrType == "client")
return false;
// pClient 에 p2p link 가 있거나, input_link 가 있는 서버에게 메세지를 보낸다.
// 다시 해석하면 pClient에게 p2pS link, output_link 인 서버에게 메세지를 보낸다.
std::vector<network::SHostInfo> bindInfo;
bindInfo.reserve(10);
pClient->GetServerInfoCorrespondClientLink(packet.bindSubServerSvrType, bindInfo);
if (bindInfo.empty())
{
clog::Error( clog::ERROR_PROBLEM, "Not Found Bind Server binSvrType : %s", packet.bindSubServerSvrType.c_str() );
return false;
}
if (bindInfo.size() > 1)
{
clog::Error( clog::ERROR_CRITICAL, "Too Many Bind Server Found binSvrType : %s", packet.bindSubServerSvrType.c_str() );
return false;
}
std::vector<std::string> links;
pSubSvrGroup->GetCorrespondClientInfo( CServerSessionAccess(GetServer()), links );
BOOST_FOREACH(auto &svrType, links)
{
SubServerGroupPtr pGroup = FindGroup(svrType);
if (!pGroup)
continue;
clog::Log( clog::LOG_F_N_O, clog::LOG_MESSAGE, 0, "CorrespondClientInfo %s", svrType.c_str() );
m_Protocol.BindSubServer( pGroup->GetNetId(), SEND_T, pSubSvrGroup->GetSvrType(),
bindInfo.front().ip, bindInfo.front().portnum );
}