本文整理汇总了C++中ArNetPacket::duplicatePacket方法的典型用法代码示例。如果您正苦于以下问题:C++ ArNetPacket::duplicatePacket方法的具体用法?C++ ArNetPacket::duplicatePacket怎么用?C++ ArNetPacket::duplicatePacket使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArNetPacket
的用法示例。
在下文中一共展示了ArNetPacket::duplicatePacket方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processPacket
//.........这里部分代码省略.........
}
// if we got a requestStop when we're not connected
else if (packet->getCommand() == ArClientCommands::REQUESTSTOP)
{
ArLog::log(ArLog::Normal,
"%sGot a requeststop while not connected.",
myLogPrefix.c_str());
return;
}
// if we're connected and its a command to execute just once
else if (myState == STATE_CONNECTED)
{
unsigned int command;
std::map<unsigned int, ArServerData *>::iterator it;
ArServerData *serverData;
command = packet->getCommand();
if ((it = myDataMap->find(command)) == myDataMap->end())
{
ArLog::log(ArLog::Terse,
"%sArServerClient got request for command %d which doesn't exist",
myLogPrefix.c_str(), command);
return;
}
serverData = (*it).second;
if (myUserInfo != NULL &&
serverData->getCommandGroup() != NULL &&
serverData->getCommandGroup()[0] != '\0' &&
myGroups.count(serverData->getCommandGroup()) == 0 &&
myGroups.count("all") == 0)
{
ArLog::log(ArLog::Normal,
"%s%s tried to request command '%s' once but it doesn't have access to that command", myLogPrefix.c_str(),
getIPString(),
serverData->getName());
return;
}
trackPacketReceived(packet, command);
// copy it out and return if its an idle packet
if (myAllowIdlePackets && serverData->isIdlePacket())
{
myHaveIdlePackets = true;
if (command <= 255)
ArLog::log(myVerboseLogLevel, "%sStoring idle command %d",
myLogPrefix.c_str(), command);
else
ArLog::log(myVerboseLogLevel, "%sStoring idle command %s",
myLogPrefix.c_str(), serverData->getName());
myIdlePacketsMutex.lock();
ArNetPacket *idlePacket = new ArNetPacket(packet->getLength() + 5);
idlePacket->duplicatePacket(packet);
myIdlePackets.push_back(idlePacket);
myIdlePacketsMutex.unlock();
return;
}
// If its a slow or an idle packet (and we're not allowing the
// idle behavior) and we allow slow packets then copy it
else if (myAllowSlowPackets && (serverData->isSlowPacket() ||
serverData->isIdlePacket()))
{
myHaveSlowPackets = true;
if (command <= 255)
ArLog::log(myVerboseLogLevel, "%sStoring slow command %d",
myLogPrefix.c_str(), command);
else
ArLog::log(myVerboseLogLevel, "%sStoring slow command %s",
myLogPrefix.c_str(), serverData->getName());
mySlowPacketsMutex.lock();
ArNetPacket *slowPacket = new ArNetPacket(packet->getLength() + 5);
slowPacket->duplicatePacket(packet);
mySlowPackets.push_back(slowPacket);
mySlowPacketsMutex.unlock();
return;
}
if (command <= 255)
ArLog::log(myVerboseLogLevel, "%sGot command %s",
myLogPrefix.c_str(), serverData->getName());
else
ArLog::log(ArLog::Verbose, "%sGot command %s",
myLogPrefix.c_str(), serverData->getName());
pushCommand(command);
pushForceTcpFlag(tcp);
if (serverData->getFunctor() != NULL)
serverData->getFunctor()->invoke(this, packet);
if (serverData->getRequestOnceFunctor() != NULL)
serverData->getRequestOnceFunctor()->invoke(this, packet);
popCommand();
popForceTcpFlag();
return;
}
else
{
ArLog::log(ArLog::Terse,
"%sRogue packet command %s in state %d", myLogPrefix.c_str(),
findCommandName(packet->getCommand()), myState);
}
}