本文整理汇总了C++中MessageHeader::isChunk方法的典型用法代码示例。如果您正苦于以下问题:C++ MessageHeader::isChunk方法的具体用法?C++ MessageHeader::isChunk怎么用?C++ MessageHeader::isChunk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageHeader
的用法示例。
在下文中一共展示了MessageHeader::isChunk方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addRequest
void MessageRequestScheduler::addRequest (DisServiceDataReqMsg::FragmentRequest *pFragReq,
bool bSeq, bool bRel)
{
if (pFragReq == NULL) {
return;
}
MessageHeader *pMH = pFragReq->pMsgHeader;
if (pMH != NULL) {
// Create the proper FragReqWrapper
FragReqWrapper *pReq = NULL;
if (pMH->isChunk()) {
pReq = new ChunkFragReqWrapper (pFragReq, bSeq, bRel, _bDeleteDuplicateRequest);
}
else {
pReq = new MessageFragReqWrapper (pFragReq, bSeq, bRel, _bDeleteDuplicateRequest);
}
if (pReq == NULL) {
checkAndLogMsg ("MessageRequestScheduler::addRequest", memoryExhausted);
delete pFragReq;
}
else {
checkAndLogMsg ("MessageRequestScheduler::addRequest", Logger::L_HighDetailDebug,
"added request for %d fragments\n",
pFragReq->pRequestedRanges->getCount());
// Insert the FragReqWrapper
_requests.insert (pReq);
}
}
}
示例2: checkAndLogMsg
PtrLList<Message> * NetworkTrafficMemory::filterRecentlySent (Message *pMsg, int64 i64RequestArrivalTime)
{
_m.lock (186);
MessageHeader *pMH = pMsg->getMessageHeader();
if (pMH == NULL) {
checkAndLogMsg ("NetworkTrafficMemory::filterRecentlySent", Logger::L_Warning,
"Message object does not contain message header.\n");
}
PtrLList<Message> *pRet = new PtrLList<Message>();
if (pRet == NULL) {
checkAndLogMsg ("NetworkTrafficMemory::filterRecentlySent", memoryExhausted);
_m.unlock (186);
return NULL;
}
if (_ui16IgnoreRequestTime == 0) {
pRet->insert (new Message (pMH->clone(), pMsg->getData()));
_m.unlock (186);
return pRet;
}
MessagesByGroup *pBG = _messageByGroup.get (pMH->getGroupName());
if (pBG == NULL) {
pRet->insert (new Message (pMH->clone(), pMsg->getData()));
_m.unlock (186);
return pRet;
}
MessagesBySender *pMS = pBG->messageBySender.get (pMH->getPublisherNodeId());
if (pMS == NULL) {
pRet->insert (new Message (pMH->clone(), pMsg->getData()));
_m.unlock (186);
return pRet;
}
FragmentedMessageHeader *pFMH = pMS->messageBySeqId.get (pMH->getMsgSeqId());
if (pFMH == NULL) {
pRet->insert (new Message (pMH->clone(), pMsg->getData()));
_m.unlock (186);
return pRet;
}
if (pMH->isChunk()) {
FragmentedChunk *pFC = ((FragmentedMessage *) pFMH)->chunksByChunkId.get (pMsg->getChunkMsgInfo()->getChunkId());
if (pFC == NULL) {
pRet->insert (new Message (pMH->clone(), pMsg->getData()));
_m.unlock (186);
return pRet;
}
else {
pFMH = pFC;
}
}
char *psFragToSendData;
psFragToSendData = (char *) pMsg->getData();
uint32 ui32FragToSendStart = pMH->getFragmentOffset();
uint32 ui32FragToSendEnd = ui32FragToSendStart + pMH->getFragmentLength();
MessageHeader *pTmpMI;
for (FragmentWrapper *pFW = pFMH->fragments.getFirst(); (pFW != NULL) && (ui32FragToSendEnd > pFW->ui32Offset); pFW = pFMH->fragments.getNext()) {
if (pFW->overlaps (ui32FragToSendStart, ui32FragToSendEnd)) {
if ((i64RequestArrivalTime - pFW->i64LastServingTime) < _ui16IgnoreRequestTime) {
// I need to split
// write everything before pFW->ui32Offset
uint32 ui32TmpFragLength = (ui32FragToSendStart < pFW->ui32Offset ? pFW->ui32Offset - ui32FragToSendStart : (uint32) 0);
if (ui32TmpFragLength > 0) {
pTmpMI = pMH->clone();
pTmpMI->setFragmentOffset (ui32FragToSendStart);
pTmpMI->setFragmentLength (ui32TmpFragLength);
pRet->insert (new Message (pTmpMI, psFragToSendData));
}
// ui32FragToSendStart = pFW->ui32End;
// psFragToSendData = psFragToSendData + ui32TmpFragLength;
ui32TmpFragLength = minimum (pFW->ui32End, ui32FragToSendEnd) - ui32FragToSendStart;
ui32FragToSendStart += ui32TmpFragLength;
psFragToSendData += ui32TmpFragLength;
}
}
}
// Add the remaining part
if (ui32FragToSendStart < ui32FragToSendEnd) {
pTmpMI = pMH->clone();
pTmpMI->setFragmentOffset (ui32FragToSendStart);
pTmpMI->setFragmentLength (ui32FragToSendEnd - ui32FragToSendStart);
pRet->insert (new Message (pTmpMI, psFragToSendData));
}
_m.unlock (186);
return pRet;
}