コード例 #1
0
void ForServerMsgHandler::NofityClientExit(BaseSession* pSession, const NetMsgHead* pMsg,int32 nSize)
{
	const SSNofityClientExit* pPacket = static_cast<const SSNofityClientExit*>(pMsg);
	int32 nClientSessionID = pPacket->nClientSessionID;

	ClientSession* pClientSession = ClientSessionMgr::Instance()->GetSession(nClientSessionID);
	ASSERT(pClientSession);

	// 同步或保存重要数据到dp

	// 通知ls,ss
	SSNofityClientExit sMsgExit;
	sMsgExit.nClientSessionID = nClientSessionID;

	pClientSession->SendMsgToLs(&sMsgExit,sMsgExit.GetPackLength());
	if(pClientSession->Status() == ECLIENT_STATUS_IN_SCENE)
	{
		pClientSession->SendMsgToSs(&sMsgExit,sMsgExit.GetPackLength());
	}else
	{
		// 由dp去保存退出操作
		pClientSession->SendMsgToDp(&sMsgExit,sMsgExit.GetPackLength());
	}

	// 删除
	ClientSessionMgr::Instance()->RemoveSession(nClientSessionID);

}
コード例 #2
0
void ForSClientMsgHandler::NofityClientSessionInfo(BaseSession* pSession, const NetMsgHead* pMsg,int32 nSize)
{
	//---------------------------------服务组代码begin-------------------------------
	ServerCommonHandler::ForServerUpdataClientUpConnectInfo(pSession,pMsg,ESERVER_TYPE_FEP);
	//---------------------------------服务组代码end-------------------------------
	int32 nClientSessionID = pMsg->nClientSessionID;
	ClientSession* pClientSession = ClientSessionMgr::Instance()->GetSession(nClientSessionID);
	if (pClientSession == NULL)
	{
		printf("Not Found ClientSession\n");
		return;
	}

	int32 nClientStatus = pClientSession->Status();
	if(nClientStatus == E_CLIENT_STATUS_NOTIFY_INITED)
	{
		F2CLoginReadyFinish sMsg;
		pClientSession->SendMsg(&sMsg,sMsg.GetPackLength());
	}

}