本文整理汇总了C++中TcpSessionPtr::setUserLParam方法的典型用法代码示例。如果您正苦于以下问题:C++ TcpSessionPtr::setUserLParam方法的具体用法?C++ TcpSessionPtr::setUserLParam怎么用?C++ TcpSessionPtr::setUserLParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TcpSessionPtr
的用法示例。
在下文中一共展示了TcpSessionPtr::setUserLParam方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: msg_onLinkServerReq
void NetManager::msg_onLinkServerReq(TcpSessionPtr session, ProtoID pID, ReadStream & rs)
{
LinkServerReq req;
rs >> req;
LOGD("enter msg_loginReq token=" << req.token << ", uID=" << req.uID);
LinkServerAck ack;
ack.retCode = EC_SUCCESS;
auto inner = UserManager::getRef().getInnerUserInfo(req.uID);
if (inner)
{
if (inner->token.token == req.token)
{
if (inner->token.tokenExpire > time(NULL))
{
ack.retCode = EC_SUCCESS;
if (inner->sID != InvalidSeesionID)
{
UserManager::getRef().userLogout(inner);
}
inner->loginTime = time(NULL);
inner->sID = session->getSessionID();
session->setUserParam(inner->userInfo.uID);
session->setUserLParam(SS_LOGINED);
session->setUserRParam(time(NULL));
WriteStream ws(ID_LinkServerAck);
ws << ack;
session->doSend(ws.getStream(), ws.getStreamLen());
UserManager::getRef().userLogin(inner);
return;
}
else
{
ack.retCode = EC_TOKEN_EXPIRE;
}
}
else
{
ack.retCode = EC_INVALIDE_USER;
}
}
else
{
ack.retCode = EC_INVALIDE_USER;
}
WriteStream ws(ID_LinkServerAck);
ws << ack;
session->doSend(ws.getStream(), ws.getStreamLen());
}
示例2: event_onSessionEstablished
void NetManager::event_onSessionEstablished(TcpSessionPtr session)
{
session->setUserLParam(SS_UNLOGIN);
LOGT("NetManager::event_onSessionEstablished. SessionID=" << session->getSessionID() << ", remoteIP=" << session->getRemoteIP() << ", remotePort=" << session->getRemotePort());
}
示例3: OnMsgPulse
void OnMsgPulse(TcpSessionPtr session, ReadStream & pack)
{
session->setUserLParam(time(NULL));
}
示例4: msg_onHeartbeatEcho
void NetManager::msg_onHeartbeatEcho(TcpSessionPtr session, ProtoID pID, ReadStream & rs)
{
session->setUserLParam(time(NULL));
}
示例5: OnSessionEstablished
void OnSessionEstablished(TcpSessionPtr session)
{
session->setUserLParam(time(NULL));
}