void EntityApp<E>::onBroadcastGlobalDataChange(Mercury::Channel* pChannel, KBEngine::MemoryStream& s) { std::string key, value; bool isDelete; s >> isDelete; s.readBlob(key); if(!isDelete) { s.readBlob(value); } PyObject * pyKey = script::Pickler::unpickle(key); if(pyKey == NULL) { ERROR_MSG("EntityApp::onBroadcastCellAppDataChange: no has key!\n"); return; } Py_INCREF(pyKey); if(isDelete) { if(pGlobalData_->del(pyKey)) { // 通知脚本 SCRIPT_OBJECT_CALL_ARGS1(getEntryScript().get(), const_cast<char*>("onGlobalDataDel"), const_cast<char*>("O"), pyKey); } } else { PyObject * pyValue = script::Pickler::unpickle(value); if(pyValue == NULL) { ERROR_MSG("EntityApp::onBroadcastCellAppDataChange: no has value!\n"); Py_DECREF(pyKey); return; } Py_INCREF(pyValue); if(pGlobalData_->write(pyKey, pyValue)) { // 通知脚本 SCRIPT_OBJECT_CALL_ARGS2(getEntryScript().get(), const_cast<char*>("onGlobalData"), const_cast<char*>("OO"), pyKey, pyValue); } Py_DECREF(pyValue); } Py_DECREF(pyKey); }
//------------------------------------------------------------------------------------- bool Interfaces::initializeEnd() { PythonApp::initializeEnd(); mainProcessTimer_ = this->dispatcher().addTimer(1000000 / g_kbeSrvConfig.gameUpdateHertz(), this, reinterpret_cast<void *>(TIMEOUT_TICK)); // 不做频道超时检查 CLOSE_CHANNEL_INACTIVITIY_DETECTION(); if (!initDB()) return false; SCOPED_PROFILE(SCRIPTCALL_PROFILE); // 所有脚本都加载完毕 PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(), const_cast<char*>("onInterfaceAppReady"), const_cast<char*>("")); if(pyResult != NULL) Py_DECREF(pyResult); else SCRIPT_ERROR_CHECK(); pTelnetServer_ = new TelnetServer(&this->dispatcher(), &this->networkInterface()); pTelnetServer_->pScript(&this->getScript()); bool ret = pTelnetServer_->start(g_kbeSrvConfig.getInterfaces().telnet_passwd, g_kbeSrvConfig.getInterfaces().telnet_deflayer, g_kbeSrvConfig.getInterfaces().telnet_port); Components::getSingleton().extraData4(pTelnetServer_->port()); return ret; }
//------------------------------------------------------------------------------------- bool Loginapp::initializeEnd() { PythonApp::initializeEnd(); // 添加一个timer, 每秒检查一些状态 mainProcessTimer_ = this->dispatcher().addTimer(1000000 / 50, this, reinterpret_cast<void *>(TIMEOUT_TICK)); SCOPED_PROFILE(SCRIPTCALL_PROFILE); // 所有脚本都加载完毕 PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(), const_cast<char*>("onLoginAppReady"), const_cast<char*>("")); if(pyResult != NULL) Py_DECREF(pyResult); else SCRIPT_ERROR_CHECK(); pTelnetServer_ = new TelnetServer(&this->dispatcher(), &this->networkInterface()); pTelnetServer_->pScript(&this->getScript()); bool ret = pTelnetServer_->start(g_kbeSrvConfig.getLoginApp().telnet_passwd, g_kbeSrvConfig.getLoginApp().telnet_deflayer, g_kbeSrvConfig.getLoginApp().telnet_port); Components::getSingleton().extraData4(pTelnetServer_->port()); return ret; }
//------------------------------------------------------------------------------------- bool ClientApp::initializeEnd() { // 所有脚本都加载完毕 PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(), const_cast<char*>("onInit"), const_cast<char*>("i"), 0); if(pyResult != NULL) { Py_DECREF(pyResult); } else { SCRIPT_ERROR_CHECK(); return false; } if(g_kbeConfig.useLastAccountName()) { EventData_LastAccountInfo eventdata; eventdata.name = g_kbeConfig.accountName(); eventHandler_.fire(&eventdata); } return true; }
//------------------------------------------------------------------------------------- void Bots::finalise() { // 结束通知脚本 PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(), const_cast<char*>("onFinish"), const_cast<char*>("")); if(pyResult != NULL) { Py_DECREF(pyResult); } else { SCRIPT_ERROR_CHECK(); } CLIENTS::iterator iter = clients_.begin(); for(; iter != clients_.end(); ++iter) { iter->second->finalise(); Py_DECREF(iter->second); } clients_.clear(); reqCreateAndLoginTotalCount_ = 0; SAFE_RELEASE(pCreateAndLoginHandler_); if(pTelnetServer_) pTelnetServer_->stop(); SAFE_RELEASE(pTelnetServer_); ClientApp::finalise(); }
//------------------------------------------------------------------------------------- bool Bots::initializeEnd() { pTelnetServer_ = new TelnetServer(&dispatcher(), &networkInterface()); pTelnetServer_->pScript(&getScript()); if(!pTelnetServer_->start(g_kbeSrvConfig.getBots().telnet_passwd, g_kbeSrvConfig.getBots().telnet_deflayer, g_kbeSrvConfig.getBots().telnet_port)) { ERROR_MSG("Bots::initialize: initializeEnd is error!\n"); return false; } // 所有脚本都加载完毕 PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(), const_cast<char*>("onInit"), const_cast<char*>("i"), 0); if(pyResult != NULL) { Py_DECREF(pyResult); } else { SCRIPT_ERROR_CHECK(); return false; } return true; }
//------------------------------------------------------------------------------------- void ClientApp::finalise(void) { // 结束通知脚本 PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(), const_cast<char*>("onFinish"), const_cast<char*>("")); if(pyResult != NULL) { Py_DECREF(pyResult); } else { SCRIPT_ERROR_CHECK(); } if(pServerChannel_ && pServerChannel_->pEndPoint()) { pServerChannel_->stopSend(); networkInterface().dispatcher().deregisterReadFileDescriptor(*pServerChannel_->pEndPoint()); networkInterface().deregisterChannel(pServerChannel_); } pServerChannel_->pPacketSender(NULL); SAFE_RELEASE(pTCPPacketSender_); SAFE_RELEASE(pTCPPacketReceiver_); gameTimer_.cancel(); threadPool_.finalise(); ClientObjectBase::finalise(); Network::finalise(); uninstallPyModules(); uninstallPyScript(); }
//------------------------------------------------------------------------------------- std::string Dbmgr::selectAccountDBInterfaceName(const std::string& name) { std::string dbInterfaceName = "default"; // 把请求交由脚本处理 SCOPED_PROFILE(SCRIPTCALL_PROFILE); PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(), const_cast<char*>("onSelectAccountDBInterface"), const_cast<char*>("s"), name.c_str()); if (pyResult != NULL) { wchar_t* PyUnicode_AsWideCharStringRet0 = PyUnicode_AsWideCharString(pyResult, NULL); char* ccattr = strutil::wchar2char(PyUnicode_AsWideCharStringRet0); dbInterfaceName = ccattr; PyMem_Free(PyUnicode_AsWideCharStringRet0); Py_DECREF(pyResult); free(ccattr); } else { SCRIPT_ERROR_CHECK(); } if (dbInterfaceName == "" || g_kbeSrvConfig.dbInterface(dbInterfaceName) == NULL) { ERROR_MSG(fmt::format("Dbmgr::selectAccountDBInterfaceName: not found dbInterface({}), accountName={}.\n", dbInterfaceName, name)); return "default"; } return dbInterfaceName; }
//------------------------------------------------------------------------------------- void Dbmgr::onShutdownBegin() { PythonApp::onShutdownBegin(); // 通知脚本 SCOPED_PROFILE(SCRIPTCALL_PROFILE); SCRIPT_OBJECT_CALL_ARGS0(getEntryScript().get(), const_cast<char*>("onDBMgrShutDown")); scriptTimers_.cancelAll(); }
//------------------------------------------------------------------------------------- void Loginapp::onReqCreateAccountResult(Network::Channel* pChannel, MemoryStream& s) { SERVER_ERROR_CODE failedcode; std::string accountName; std::string password; std::string retdatas = ""; s >> failedcode >> accountName >> password; s.readBlob(retdatas); // 把请求交由脚本处理 SCOPED_PROFILE(SCRIPTCALL_PROFILE); PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(), const_cast<char*>("onCreateAccountCallbackFromDB"), const_cast<char*>("sHy#"), accountName.c_str(), failedcode, retdatas.c_str(), retdatas.length()); if(pyResult != NULL) { Py_DECREF(pyResult); } else { SCRIPT_ERROR_CHECK(); } DEBUG_MSG(fmt::format("Loginapp::onReqCreateAccountResult: accountName={}, failedcode={}.\n", accountName.c_str(), failedcode)); PendingLoginMgr::PLInfos* ptinfos = pendingCreateMgr_.remove(accountName); if(ptinfos == NULL) return; Network::Channel* pClientChannel = this->networkInterface().findChannel(ptinfos->addr); if(pClientChannel == NULL) return; pClientChannel->extra(""); Network::Bundle* pBundle = Network::Bundle::createPoolObject(); (*pBundle).newMessage(ClientInterface::onCreateAccountResult); (*pBundle) << failedcode; (*pBundle).appendBlob(retdatas); pClientChannel->send(pBundle); SAFE_RELEASE(ptinfos); }
void EntityApp<E>::reloadScript(bool fullReload) { EntityDef::reload(fullReload); onReloadScript(fullReload); // 所有脚本都加载完毕 PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(), const_cast<char*>("onInit"), const_cast<char*>("i"), 1); if(pyResult != NULL) Py_DECREF(pyResult); else SCRIPT_ERROR_CHECK(); }
//------------------------------------------------------------------------------------- void Interfaces::reqCreateAccount(Network::Channel* pChannel, KBEngine::MemoryStream& s) { std::string registerName, accountName, password, datas; COMPONENT_ID cid; uint8 accountType = 0; s >> cid >> registerName >> password >> accountType; s.readBlob(datas); if(accountType == (uint8)ACCOUNT_TYPE_MAIL) { } REQCREATE_MAP::iterator iter = reqCreateAccount_requests_.find(registerName); if(iter != reqCreateAccount_requests_.end()) { return; } CreateAccountTask* pinfo = new CreateAccountTask(); pinfo->commitName = registerName; pinfo->accountName = registerName; pinfo->getDatas = ""; pinfo->password = password; pinfo->postDatas = datas; pinfo->retcode = SERVER_ERR_OP_FAILED; pinfo->baseappID = cid; pinfo->dbmgrID = pChannel->componentID(); pinfo->address = pChannel->addr(); pinfo->enable = true; reqCreateAccount_requests_[pinfo->commitName] = pinfo; // 把请求交由脚本处理 SCOPED_PROFILE(SCRIPTCALL_PROFILE); PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(), const_cast<char*>("onRequestCreateAccount"), const_cast<char*>("ssy#"), registerName.c_str(), password.c_str(), datas.c_str(), datas.length()); if(pyResult != NULL) Py_DECREF(pyResult); else SCRIPT_ERROR_CHECK(); }
//------------------------------------------------------------------------------------- void PythonApp::reloadScript(bool fullReload) { onReloadScript(fullReload); // SCOPED_PROFILE(SCRIPTCALL_PROFILE); // 所有脚本都加载完毕 PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(), const_cast<char*>("onInit"), const_cast<char*>("i"), 1); if(pyResult != NULL) Py_DECREF(pyResult); else SCRIPT_ERROR_CHECK(); }
//------------------------------------------------------------------------------------- void ClientApp::onTargetChanged() { // 所有脚本都加载完毕 PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(), const_cast<char*>("onTargetChanged"), const_cast<char*>("i"), targetID_); if(pyResult != NULL) { Py_DECREF(pyResult); } else { SCRIPT_ERROR_CHECK(); } }
//------------------------------------------------------------------------------------- void Interfaces::charge(Network::Channel* pChannel, KBEngine::MemoryStream& s) { OrdersCharge* pOrdersCharge = new OrdersCharge(); pOrdersCharge->timeout = timestamp() + uint64(g_kbeSrvConfig.interfaces_orders_timeout_ * stampsPerSecond()); pOrdersCharge->dbmgrID = pChannel->componentID(); pOrdersCharge->address = pChannel->addr(); s >> pOrdersCharge->baseappID; s >> pOrdersCharge->ordersID; s >> pOrdersCharge->dbid; s.readBlob(pOrdersCharge->postDatas); s >> pOrdersCharge->cbid; INFO_MSG(fmt::format("Interfaces::charge: componentID={4}, chargeID={0}, dbid={1}, cbid={2}, datas={3}!\n", pOrdersCharge->ordersID, pOrdersCharge->dbid, pOrdersCharge->cbid, pOrdersCharge->postDatas, pOrdersCharge->baseappID)); ORDERS::iterator iter = orders_.find(pOrdersCharge->ordersID); if(iter != orders_.end()) { ERROR_MSG(fmt::format("Interfaces::charge: chargeID={} is exist!\n", pOrdersCharge->ordersID)); delete pOrdersCharge; return; } ChargeTask* pinfo = new ChargeTask(); pinfo->orders = *pOrdersCharge; pinfo->pOrders = pOrdersCharge; orders_[pOrdersCharge->ordersID].reset(pOrdersCharge); // 把请求交由脚本处理 SCOPED_PROFILE(SCRIPTCALL_PROFILE); PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(), const_cast<char*>("onRequestCharge"), const_cast<char*>("sKy#"), pOrdersCharge->ordersID.c_str(), pOrdersCharge->dbid, pOrdersCharge->postDatas.c_str(), pOrdersCharge->postDatas.length()); if(pyResult != NULL) Py_DECREF(pyResult); else SCRIPT_ERROR_CHECK(); }
//------------------------------------------------------------------------------------- bool Dbmgr::initializeEnd() { // 添加一个timer, 每秒检查一些状态 loopCheckTimerHandle_ = this->dispatcher().addTimer(1000000, this, reinterpret_cast<void *>(TIMEOUT_CHECK_STATUS)); mainProcessTimer_ = this->dispatcher().addTimer(1000000 / 50, this, reinterpret_cast<void *>(TIMEOUT_TICK)); // 添加globalData, baseAppData, cellAppData支持 pGlobalData_ = new GlobalDataServer(GlobalDataServer::GLOBAL_DATA); pBaseAppData_ = new GlobalDataServer(GlobalDataServer::BASEAPP_DATA); pCellAppData_ = new GlobalDataServer(GlobalDataServer::CELLAPP_DATA); pGlobalData_->addConcernComponentType(CELLAPP_TYPE); pGlobalData_->addConcernComponentType(BASEAPP_TYPE); pBaseAppData_->addConcernComponentType(BASEAPP_TYPE); pCellAppData_->addConcernComponentType(CELLAPP_TYPE); INFO_MSG(fmt::format("Dbmgr::initializeEnd: digest({})\n", EntityDef::md5().getDigestStr())); SCOPED_PROFILE(SCRIPTCALL_PROFILE); // 所有脚本都加载完毕 PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(), const_cast<char*>("onDBMgrReady"), const_cast<char*>("")); if(pyResult != NULL) Py_DECREF(pyResult); else SCRIPT_ERROR_CHECK(); pTelnetServer_ = new TelnetServer(&this->dispatcher(), &this->networkInterface()); pTelnetServer_->pScript(&this->getScript()); bool ret = pTelnetServer_->start(g_kbeSrvConfig.getDBMgr().telnet_passwd, g_kbeSrvConfig.getDBMgr().telnet_deflayer, g_kbeSrvConfig.getDBMgr().telnet_port); Components::getSingleton().extraData4(pTelnetServer_->port()); return ret && initInterfacesHandler() && initDB(); }
//------------------------------------------------------------------------------------- void Interfaces::onAccountLogin(Network::Channel* pChannel, KBEngine::MemoryStream& s) { std::string loginName, accountName, password, datas; COMPONENT_ID cid; s >> cid >> loginName >> password; s.readBlob(datas); REQLOGIN_MAP::iterator iter = reqAccountLogin_requests_.find(loginName); if(iter != reqAccountLogin_requests_.end()) { return; } LoginAccountTask* pinfo = new LoginAccountTask(); pinfo->commitName = loginName; pinfo->accountName = loginName; pinfo->getDatas = ""; pinfo->password = password; pinfo->postDatas = datas; pinfo->retcode = SERVER_ERR_OP_FAILED; pinfo->baseappID = cid; pinfo->dbmgrID = pChannel->componentID(); pinfo->address = pChannel->addr(); pinfo->enable = true; reqAccountLogin_requests_[pinfo->commitName] = pinfo; // 把请求交由脚本处理 SCOPED_PROFILE(SCRIPTCALL_PROFILE); PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(), const_cast<char*>("onRequestAccountLogin"), const_cast<char*>("ssy#"), loginName.c_str(), password.c_str(), datas.c_str(), datas.length()); if(pyResult != NULL) Py_DECREF(pyResult); else SCRIPT_ERROR_CHECK(); }
//------------------------------------------------------------------------------------- bool ClientApp::initializeEnd() { // 所有脚本都加载完毕 PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(), const_cast<char*>("onInit"), const_cast<char*>("i"), 0); if(pyResult != NULL) { Py_DECREF(pyResult); } else { SCRIPT_ERROR_CHECK(); return false; } return true; }
//------------------------------------------------------------------------------------- bool Loginapp::_createAccount(Network::Channel* pChannel, std::string& accountName, std::string& password, std::string& datas, ACCOUNT_TYPE type) { AUTO_SCOPED_PROFILE("createAccount"); ACCOUNT_TYPE oldType = type; if(!g_kbeSrvConfig.getDBMgr().account_registration_enable) { WARNING_MSG(fmt::format("Loginapp::_createAccount({}): not available!\n", accountName)); std::string retdatas = ""; Network::Bundle* pBundle = Network::Bundle::createPoolObject(); (*pBundle).newMessage(ClientInterface::onCreateAccountResult); SERVER_ERROR_CODE retcode = SERVER_ERR_ACCOUNT_REGISTER_NOT_AVAILABLE; (*pBundle) << retcode; (*pBundle).appendBlob(retdatas); pChannel->send(pBundle); return false; } accountName = KBEngine::strutil::kbe_trim(accountName); password = KBEngine::strutil::kbe_trim(password); if(accountName.size() > ACCOUNT_NAME_MAX_LENGTH) { ERROR_MSG(fmt::format("Loginapp::_createAccount: accountName too big, size={}, limit={}.\n", accountName.size(), ACCOUNT_NAME_MAX_LENGTH)); return false; } if(password.size() > ACCOUNT_PASSWD_MAX_LENGTH) { ERROR_MSG(fmt::format("Loginapp::_createAccount: password too big, size={}, limit={}.\n", password.size(), ACCOUNT_PASSWD_MAX_LENGTH)); return false; } if(datas.size() > ACCOUNT_DATA_MAX_LENGTH) { ERROR_MSG(fmt::format("Loginapp::_createAccount: bindatas too big, size={}, limit={}.\n", datas.size(), ACCOUNT_DATA_MAX_LENGTH)); return false; } std::string retdatas = ""; if(shuttingdown_ != SHUTDOWN_STATE_STOP) { WARNING_MSG(fmt::format("Loginapp::_createAccount: shutting down, create {} failed!\n", accountName)); Network::Bundle* pBundle = Network::Bundle::createPoolObject(); (*pBundle).newMessage(ClientInterface::onCreateAccountResult); SERVER_ERROR_CODE retcode = SERVER_ERR_IN_SHUTTINGDOWN; (*pBundle) << retcode; (*pBundle).appendBlob(retdatas); pChannel->send(pBundle); return false; } PendingLoginMgr::PLInfos* ptinfos = pendingCreateMgr_.find(const_cast<std::string&>(accountName)); if(ptinfos != NULL) { WARNING_MSG(fmt::format("Loginapp::_createAccount: pendingCreateMgr has {}, request create failed!\n", accountName)); Network::Bundle* pBundle = Network::Bundle::createPoolObject(); (*pBundle).newMessage(ClientInterface::onCreateAccountResult); SERVER_ERROR_CODE retcode = SERVER_ERR_BUSY; (*pBundle) << retcode; (*pBundle).appendBlob(retdatas); pChannel->send(pBundle); return false; } { // 把请求交由脚本处理 SERVER_ERROR_CODE retcode = SERVER_SUCCESS; SCOPED_PROFILE(SCRIPTCALL_PROFILE); PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(), const_cast<char*>("onRequestCreateAccount"), const_cast<char*>("ssy#"), accountName.c_str(), password.c_str(), datas.c_str(), datas.length()); if(pyResult != NULL) { if(PySequence_Check(pyResult) && PySequence_Size(pyResult) == 4) { char* sname; char* spassword; char *extraDatas; Py_ssize_t extraDatas_size = 0; if(PyArg_ParseTuple(pyResult, "H|s|s|y#", &retcode, &sname, &spassword, &extraDatas, &extraDatas_size) == -1) { ERROR_MSG(fmt::format("Loginapp::_createAccount: {}.onReuqestLogin, Return value error! accountName={}\n", g_kbeSrvConfig.getLoginApp().entryScriptFile, accountName)); retcode = SERVER_ERR_OP_FAILED; } else { accountName = sname; password = spassword; if (extraDatas && extraDatas_size > 0) datas.assign(extraDatas, extraDatas_size); else SCRIPT_ERROR_CHECK(); } } else { ERROR_MSG(fmt::format("Loginapp::_createAccount: {}.onReuqestLogin, Return value error, must be errorcode or tuple! accountName={}\n", g_kbeSrvConfig.getLoginApp().entryScriptFile, accountName)); retcode = SERVER_ERR_OP_FAILED; } Py_DECREF(pyResult); } else { SCRIPT_ERROR_CHECK(); retcode = SERVER_ERR_OP_FAILED; } if(retcode != SERVER_SUCCESS) { Network::Bundle* pBundle = Network::Bundle::createPoolObject(); (*pBundle).newMessage(ClientInterface::onCreateAccountResult); (*pBundle) << retcode; (*pBundle).appendBlob(retdatas); pChannel->send(pBundle); return false; } else { if(accountName.size() == 0) { ERROR_MSG(fmt::format("Loginapp::_createAccount: accountName is empty!\n")); retcode = SERVER_ERR_NAME; Network::Bundle* pBundle = Network::Bundle::createPoolObject(); (*pBundle).newMessage(ClientInterface::onCreateAccountResult); (*pBundle) << retcode; (*pBundle).appendBlob(retdatas); pChannel->send(pBundle); return false; } } } if(type == ACCOUNT_TYPE_SMART) { if (email_isvalid(accountName.c_str())) { type = ACCOUNT_TYPE_MAIL; } else { if(!validName(accountName)) { ERROR_MSG(fmt::format("Loginapp::_createAccount: invalid accountName({})\n", accountName)); Network::Bundle* pBundle = Network::Bundle::createPoolObject(); (*pBundle).newMessage(ClientInterface::onCreateAccountResult); SERVER_ERROR_CODE retcode = SERVER_ERR_NAME; (*pBundle) << retcode; (*pBundle).appendBlob(retdatas); pChannel->send(pBundle); return false; } type = ACCOUNT_TYPE_NORMAL; } } else if(type == ACCOUNT_TYPE_NORMAL) { if(!validName(accountName)) { ERROR_MSG(fmt::format("Loginapp::_createAccount: invalid accountName({})\n", accountName)); Network::Bundle* pBundle = Network::Bundle::createPoolObject(); (*pBundle).newMessage(ClientInterface::onCreateAccountResult); SERVER_ERROR_CODE retcode = SERVER_ERR_NAME; (*pBundle) << retcode; (*pBundle).appendBlob(retdatas); pChannel->send(pBundle); return false; } } else if (!email_isvalid(accountName.c_str())) { /* std::string user_name, domain_name; user_name = regex_replace(accountName, _g_mail_pattern, std::string("$1") ); domain_name = regex_replace(accountName, _g_mail_pattern, std::string("$2") ); */ WARNING_MSG(fmt::format("Loginapp::_createAccount: invalid mail={}\n", accountName)); Network::Bundle* pBundle = Network::Bundle::createPoolObject(); (*pBundle).newMessage(ClientInterface::onCreateAccountResult); SERVER_ERROR_CODE retcode = SERVER_ERR_NAME_MAIL; (*pBundle) << retcode; (*pBundle).appendBlob(retdatas); pChannel->send(pBundle); return false; } DEBUG_MSG(fmt::format("Loginapp::_createAccount: accountName={}, passwordsize={}, type={}, oldType={}.\n", accountName.c_str(), password.size(), type, oldType)); ptinfos = new PendingLoginMgr::PLInfos; ptinfos->accountName = accountName; ptinfos->password = password; ptinfos->datas = datas; ptinfos->addr = pChannel->addr(); pendingCreateMgr_.add(ptinfos); Components::COMPONENTS& cts = Components::getSingleton().getComponents(DBMGR_TYPE); Components::ComponentInfos* dbmgrinfos = NULL; if(cts.size() > 0) dbmgrinfos = &(*cts.begin()); if(dbmgrinfos == NULL || dbmgrinfos->pChannel == NULL || dbmgrinfos->cid == 0) { ERROR_MSG(fmt::format("Loginapp::_createAccount: create({}), not found dbmgr!\n", accountName)); Network::Bundle* pBundle = Network::Bundle::createPoolObject(); (*pBundle).newMessage(ClientInterface::onCreateAccountResult); SERVER_ERROR_CODE retcode = SERVER_ERR_SRV_NO_READY; (*pBundle) << retcode; (*pBundle).appendBlob(retdatas); pChannel->send(pBundle); return false; } pChannel->extra(accountName); Network::Bundle* pBundle = Network::Bundle::createPoolObject(); (*pBundle).newMessage(DbmgrInterface::reqCreateAccount); uint8 uatype = uint8(type); (*pBundle) << accountName << password << uatype; (*pBundle).appendBlob(datas); dbmgrinfos->pChannel->send(pBundle); return true; }