本文整理汇总了C++中ObPacket::getPCode方法的典型用法代码示例。如果您正苦于以下问题:C++ ObPacket::getPCode方法的具体用法?C++ ObPacket::getPCode怎么用?C++ ObPacket::getPCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObPacket
的用法示例。
在下文中一共展示了ObPacket::getPCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
tbnet::IPacketHandler::HPRetCode MockNodeServer::handlePacket(tbnet::Connection* connection, tbnet::Packet *packet)
{
tbnet::IPacketHandler::HPRetCode rc = tbnet::IPacketHandler::FREE_CHANNEL;
if (!packet->isRegularPacket())
{
TBSYS_LOG(WARN, "control packet, packet code: %d", ((tbnet::ControlPacket*)packet)->getCommand());
}
else
{
ObPacket* req = (ObPacket*) packet;
req->set_connection(connection);
int packet_code = req->get_packet_code();
bool ps = false;
switch(packet_code)
{
case OB_MMS_HEART_BEAT:
case OB_MMS_STOP_SLAVE:
case OB_MMS_SLAVE_DOWN:
case OB_MMS_TRANSFER_2_MASTER:
ps = node_.handlePacket(req);
break;
default:
ps = MockServer::handlePacket(connection, packet);
break;
}
if (!ps)
{
TBSYS_LOG(WARN, "overflow packet dropped, packet code: %d", req->getPCode());
rc = tbnet::IPacketHandler::KEEP_CHANNEL;
}
}
return rc;
}