void NFCProxyServerNet_ServerModule::OnConnectKeyProcess(const int nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { NFGUID nPlayerID; NFMsg::ReqAccountLogin xMsg; if (!m_pNetModule->ReceivePB(nSockIndex, nMsgID, msg, nLen, xMsg, nPlayerID)) { return; } bool bRet = m_pProxyToWorldModule->VerifyConnectData(xMsg.account(), xMsg.security_code()); if (bRet) { //可以进入,设置标志,选单服,心跳延迟,进入gs创建角色和删除角色,这里只是转发 NetObject* pNetObject = m_pNetModule->GetNet()->GetNetObject(nSockIndex); if (pNetObject) { pNetObject->SetConnectKeyState(1); pNetObject->SetAccount(xMsg.account()); NFMsg::AckEventResult xSendMsg; xSendMsg.set_event_code(NFMsg::EGEC_VERIFY_KEY_SUCCESS); *xSendMsg.mutable_event_client() = NFINetModule::NFToPB(pNetObject->GetClientID());//让前端记得自己的fd,后面有一些验证 m_pNetModule->SendMsgPB(NFMsg::EGameMsgID::EGMI_ACK_CONNECT_KEY, xSendMsg, nSockIndex); } } else { m_pNetModule->GetNet()->CloseNetObject(nSockIndex); } }
void NFCLoginLogicModule::OnLoginProcess(const int nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { NFINetModule* pNetModule = m_pLoginNet_ServerModule->GetNetModule(); NFGUID nPlayerID; NFMsg::ReqAccountLogin xMsg; if (!pNetModule->ReceivePB(nSockIndex, nMsgID, msg, nLen, xMsg, nPlayerID)) { return; } NetObject* pNetObject = pNetModule->GetNet()->GetNetObject(nSockIndex); if (pNetObject) { if (pNetObject->GetConnectKeyState() == 0) { //int nState = m_pLoginLogicModule->OnLoginProcess(pNetObject->GetClientID(), xMsg.account(), xMsg.password()); int nState = 0; if (0 != nState) { std::ostringstream strLog; strLog << "Check password failed, Account = " << xMsg.account() << " Password = "******"Login successed :", xMsg.account().c_str()); } } }
int NFCLoginNet_ServerModule::OnLoginProcess( const NFIPacket& msg ) { NFIDENTID nPlayerID; NFMsg::ReqAccountLogin xMsg; if (!RecivePB(msg, xMsg, nPlayerID)) { return 0; } NetObject* pNetObject = GetNet()->GetNetObject(msg.GetFd()); if (pNetObject) { //还没有登录过 if (pNetObject->GetConnectKeyState() == 0) { NFCDataList val; val << pNetObject->GetClientID()<< xMsg.account() << xMsg.password(); m_pEventProcessModule->DoEvent(NFIDENTID(), NFED_ON_CLIENT_LOGIN, val); } } return 0; }