//------------------------------------------------------------------------------------- void Baseappmgr::registerPendingAccountToBaseappAddr(Network::Channel* pChannel, MemoryStream& s) { COMPONENT_ID componentID; std::string loginName; std::string accountName; std::string password; std::string datas; ENTITY_ID entityID; DBID entityDBID; uint32 flags; uint64 deadline; COMPONENT_TYPE componentType; s >> componentID >> loginName >> accountName >> password >> entityID >> entityDBID >> flags >> deadline >> componentType; s.readBlob(datas); DEBUG_MSG(fmt::format("Baseappmgr::registerPendingAccountToBaseappAddr:{0}, componentID={1}, entityID={2}.\n", accountName, componentID, entityID)); Components::ComponentInfos* cinfos = Components::getSingleton().findComponent(pChannel); if(cinfos == NULL || cinfos->pChannel == NULL) { ERROR_MSG("Baseappmgr::registerPendingAccountToBaseapp: not found loginapp!\n"); return; } pending_logins_[loginName] = cinfos->cid; cinfos = Components::getSingleton().findComponent(componentID); if(cinfos == NULL || cinfos->pChannel == NULL) { ERROR_MSG(fmt::format("Baseappmgr::registerPendingAccountToBaseappAddr: not found baseapp({}).\n", componentID)); sendAllocatedBaseappAddr(pChannel, loginName, accountName, "", 0); return; } Network::Bundle* pBundle = Network::Bundle::ObjPool().createObject(); (*pBundle).newMessage(BaseappInterface::registerPendingLogin); (*pBundle) << loginName << accountName << password << entityID << entityDBID << flags << deadline << componentType; pBundle->appendBlob(datas); cinfos->pChannel->send(pBundle); }
//------------------------------------------------------------------------------------- void Baseappmgr::registerPendingAccountToBaseappAddr(Mercury::Channel* pChannel, COMPONENT_ID componentID, std::string& loginName, std::string& accountName, std::string& password, ENTITY_ID entityID, DBID entityDBID, uint32 flags, uint64 deadline, COMPONENT_TYPE componentType) { DEBUG_MSG(boost::format("Baseappmgr::registerPendingAccountToBaseappAddr:%1%, componentID=%2%, entityID=%3%.\n") % accountName.c_str() % componentID % entityID); Components::ComponentInfos* cinfos = Components::getSingleton().findComponent(componentID); if(cinfos == NULL || cinfos->pChannel == NULL) { ERROR_MSG(boost::format("Baseappmgr::onPendingAccountGetBaseappAddr: not found baseapp(%1%).") % componentID); return; } Mercury::Bundle* pBundle = Mercury::Bundle::ObjPool().createObject(); (*pBundle).newMessage(BaseappInterface::registerPendingLogin); (*pBundle) << loginName << accountName << password << entityID << entityDBID << flags << deadline << componentType; (*pBundle).send(this->getNetworkInterface(), cinfos->pChannel); Mercury::Bundle::ObjPool().reclaimObject(pBundle); sendAllocatedBaseappAddr(pChannel, loginName, accountName, cinfos->pExtAddr->ip, cinfos->pExtAddr->port); }
//------------------------------------------------------------------------------------- void Baseappmgr::registerPendingAccountToBaseapp(Mercury::Channel* pChannel, std::string& loginName, std::string& accountName, std::string& password, DBID entityDBID, uint32 flags, uint64 deadline, COMPONENT_TYPE componentType) { ENTITY_ID eid = 0; Components::ComponentInfos* cinfos = Components::getSingleton().findComponent(BASEAPP_TYPE, bestBaseappID_); if(cinfos == NULL || cinfos->pChannel == NULL) { Mercury::Bundle* pBundle = Mercury::Bundle::ObjPool().createObject(); ForwardItem* pFI = new ForwardItem(); pFI->pBundle = pBundle; (*pBundle).newMessage(BaseappInterface::registerPendingLogin); (*pBundle) << loginName << accountName << password << eid << entityDBID << flags << deadline << componentType; WARNING_MSG("Baseappmgr::registerPendingAccountToBaseapp: not found baseapp, message is buffered.\n"); pFI->pHandler = NULL; forward_baseapp_messagebuffer_.push(pFI); return; } DEBUG_MSG(boost::format("Baseappmgr::registerPendingAccountToBaseapp:%1%. allocBaseapp=[%2%].\n") % accountName.c_str() % bestBaseappID_); Mercury::Bundle* pBundle = Mercury::Bundle::ObjPool().createObject(); (*pBundle).newMessage(BaseappInterface::registerPendingLogin); (*pBundle) << loginName << accountName << password << eid << entityDBID << flags << deadline << componentType; (*pBundle).send(this->getNetworkInterface(), cinfos->pChannel); Mercury::Bundle::ObjPool().reclaimObject(pBundle); sendAllocatedBaseappAddr(pChannel, loginName, accountName, cinfos->pExtAddr->ip, cinfos->pExtAddr->port); }
//------------------------------------------------------------------------------------- void Baseappmgr::onPendingAccountGetBaseappAddr(Network::Channel* pChannel, std::string& loginName, std::string& accountName, std::string& addr, uint16 port) { sendAllocatedBaseappAddr(pChannel, loginName, accountName, addr, port); }