本文整理汇总了C++中CSession::GetClcSessionId方法的典型用法代码示例。如果您正苦于以下问题:C++ CSession::GetClcSessionId方法的具体用法?C++ CSession::GetClcSessionId怎么用?C++ CSession::GetClcSessionId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSession
的用法示例。
在下文中一共展示了CSession::GetClcSessionId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReceiveIpcHandler
int CMain::ReceiveIpcHandler()
{
int cmdCode = 0;
string strCmdCode;
CGlobal *cGlob = NULL;
CModuleIPC *cIpc = NULL;
CProtocol cProto;
char chFlag = 0;
int nRet = 0;
cGlob = CGlobal::GetInstance();
cIpc = cGlob->GetModuleIPC();
nRet = cIpc->RecvMesg(cGlob->GetLocalProcNo(), cProto, -1);
if(nRet < 0){
CLA_LOG(CLA_ERR,false,"Message receive failed(ERR:%s)\n", cIpc->m_strErrorMsg.c_str());
return CLA_NOK;
}
else if(nRet == 0){
return CLA_OK;
}
chFlag = cProto.GetFlag();
if((chFlag != CProtocol::FLAG_RESPONSE)){
CLA_LOG(CLA_ERR,false,"Invalid Flag(flag=%d)\n",chFlag);
return CLA_NOK;
}
strCmdCode = cProto.GetCommand();
cmdCode = CGlobal::GetCmdCode(strCmdCode);
switch(cmdCode){
case CMD_CLI_COMMAND:
{
unsigned int fd = 0;
unsigned int nSessionId = 0;
CCliPeer *cPeer = NULL;
CSession *cSession = NULL;
CCliRsp decRsp;
string strPayload;
nSessionId = cProto.GetSequence();
cSession = FindSession(nSessionId);
if(cSession == NULL){
CLA_LOG(CLA_ERR,false,"Can not find session(id=%d)\n",nSessionId);
return CLA_NOK;
}
strPayload = cProto.GetPayload();
decRsp.DecodeMessage(strPayload);
decRsp.SetSessionId(cSession->GetClcSessionId());
decRsp.EncodeMessage(strPayload);
cProto.SetPayload(strPayload);
cProto.SetSequence(cSession->GetClcSessionId());
fd = cSession->GetPeerFd();
cPeer = FindPeerByFd(fd);
if(cPeer == NULL){
CLA_LOG(CLA_ERR,false,"Can not find peer(fd=%d)\n",fd);
delete cSession;
return CLA_NOK;
}
if(cPeer->GetTimestamp() != cSession->GetPeerTimestamp()){
CLA_LOG(CLA_ERR,false,"Can not find peer(timestamp=%lu, %lu)\n",
cPeer->GetTimestamp() ,cSession->GetPeerTimestamp());
delete cSession;
return CLA_NOK;
}
/* update hist */
UpdateHist(cPeer, cSession, &decRsp);
cPeer->Send(cProto);
delete cSession;
}
break;
default :
CLA_LOG(CLA_ERR,false,"Invalid cmdCode(%s)\n",cProto.GetCommand().c_str());
return CLA_NOK;
};
return CLA_OK;
}