本文整理汇总了C++中VarList::GetInt方法的典型用法代码示例。如果您正苦于以下问题:C++ VarList::GetInt方法的具体用法?C++ VarList::GetInt怎么用?C++ VarList::GetInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VarList
的用法示例。
在下文中一共展示了VarList::GetInt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CompleteRecv
void NetSystem::CompleteRecv(epoll_event& event) {
LinkInfo * pLink = (LinkInfo *) event.data.ptr;
//如果是已经连接的用户,并且收到数据,那么进行读入。
char recvbuff[RECVBUF_SIZE];
memset(recvbuff, 0, RECVBUF_SIZE);
int nRecvLen = 0;
//在这里会不会出现因为tpc接受缓冲区一直有东西存在 所以就直卡死在这个read中 所以改成read一次
//但是有可能出现消息丢失
while (true) { //这里注意 要增加 频率检测
if ((nRecvLen = read(pLink->m_socket, recvbuff, RECVBUF_SIZE)) <= 0) {
if (EAGAIN == errno && -1 == nRecvLen) {
break;
}
if (0 == nRecvLen) {
LOG_ERROR("NetSystem::MainLoop client is EOF, LinkID : %d", pLink->m_socket);
m_pCallBackSystem->ExKernelEvent(m_pKernel,
pLink->m_remotetype, KERNEL_EVENT_CONNECTION_EOF, pLink->m_socket, VarList());
} else {
LOG_ERROR("NetSystem::MainLoop client is break off, LinkID : %d", pLink->m_socket);
m_pCallBackSystem->ExKernelEvent(m_pKernel,
pLink->m_remotetype, KERNEL_EVENT_CONNECTION_BREAK, pLink->m_socket, VarList());
}
CleanLink(pLink);
event.data.ptr = NULL;
break;
}
if (!pLink->m_recvstream.WriteBuff(recvbuff, nRecvLen)) {
LOG_TRACE("NetSystem::MainLoop WriteBuff error, LinkID : %d", pLink->m_socket);
m_pCallBackSystem->ExKernelEvent(m_pKernel,
pLink->m_remotetype, KERNEL_EVENT_CONNECTION_BREAK, pLink->m_socket, VarList());
CleanLink(pLink);
event.data.ptr = NULL;
break;
}
Archive msg;
VarList args;
while (pLink->m_recvstream.ReadArchive(msg)) {
if (msg.ToVarList(args)) {
if (args.Type(0) != TYPE_INT) {
LOG_ERROR("NetSystem::MainLoop Error msg");
m_pCallBackSystem->ExKernelEvent(m_pKernel,
pLink->m_remotetype, KERNEL_EVENT_CONNECTION_BREAK, pLink->m_socket, VarList());
CleanLink(pLink);
event.data.ptr = NULL;
break;
}
UI32 nMsgId = args.GetInt(0);
m_pCallBackSystem->ExMsgCall(m_pKernel, pLink->m_remotetype, nMsgId, pLink->m_socket, args);
const CIdentity player = m_pObjectManage->QueryPlayer(pLink->m_socket);
if (player != CIdentity_INIT()) {
m_pCallBackSystem->ExMsgCall(m_pKernel, pLink->m_remotetype, nMsgId, player, args);
}
}
}
}
if (pLink != NULL) {
//设置用于写操作的文件描述符
struct epoll_event ev;
ev.data.ptr = pLink;
ev.events = EPOLLIN | EPOLLOUT | EPOLLET;
epoll_ctl(m_epfd, EPOLL_CTL_MOD, pLink->m_socket, &ev);
}
return;
}