本文整理汇总了C++中network::Channel::extra方法的典型用法代码示例。如果您正苦于以下问题:C++ Channel::extra方法的具体用法?C++ Channel::extra怎么用?C++ Channel::extra使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类network::Channel
的用法示例。
在下文中一共展示了Channel::extra方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onReqCreateAccountResult
//-------------------------------------------------------------------------------------
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);
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::ObjPool().createObject();
(*pBundle).newMessage(ClientInterface::onCreateAccountResult);
(*pBundle) << failedcode;
(*pBundle).appendBlob(retdatas);
pClientChannel->send(pBundle);
SAFE_RELEASE(ptinfos);
}
示例2: onReqCreateAccountResult
//-------------------------------------------------------------------------------------
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);
}
示例3: onReqCreateMailAccountResult
//-------------------------------------------------------------------------------------
void Loginapp::onReqCreateMailAccountResult(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);
DEBUG_MSG(fmt::format("Loginapp::onReqCreateMailAccountResult: accountName={}, failedcode={}.\n",
accountName.c_str(), failedcode));
if(failedcode == SERVER_SUCCESS)
{
Components::COMPONENTS& loginapps = Components::getSingleton().getComponents(LOGINAPP_TYPE);
std::string http_host = "localhost";
if(startGroupOrder_ == 1)
{
if(strlen((const char*)&g_kbeSrvConfig.getLoginApp().externalAddress) > 0)
http_host = g_kbeSrvConfig.getBaseApp().externalAddress;
else
http_host = inet_ntoa((struct in_addr&)Loginapp::getSingleton().networkInterface().extaddr().ip);
}
else
{
Components::COMPONENTS::iterator iter = loginapps.begin();
for(; iter != loginapps.end(); ++iter)
{
if((*iter).groupOrderid == 1)
{
if(strlen((const char*)&(*iter).externalAddressEx) > 0)
http_host = (*iter).externalAddressEx;
else
http_host = inet_ntoa((struct in_addr&)(*iter).pExtAddr->ip);
}
}
}
threadPool_.addTask(new SendActivateEMailTask(accountName, retdatas,
http_host,
g_kbeSrvConfig.getLoginApp().http_cbport));
}
PendingLoginMgr::PLInfos* ptinfos = pendingCreateMgr_.remove(accountName);
if(ptinfos == NULL)
return;
Network::Channel* pClientChannel = this->networkInterface().findChannel(ptinfos->addr);
if(pClientChannel == NULL)
return;
pClientChannel->extra("");
retdatas = "";
Network::Bundle* pBundle = Network::Bundle::createPoolObject();
(*pBundle).newMessage(ClientInterface::onCreateAccountResult);
(*pBundle) << failedcode;
(*pBundle).appendBlob(retdatas);
pClientChannel->send(pBundle);
SAFE_RELEASE(ptinfos);
}