本文整理汇总了C++中Transporter::getWritePtr方法的典型用法代码示例。如果您正苦于以下问题:C++ Transporter::getWritePtr方法的具体用法?C++ Transporter::getWritePtr怎么用?C++ Transporter::getWritePtr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transporter
的用法示例。
在下文中一共展示了Transporter::getWritePtr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reportError
SendStatus
TransporterRegistry::prepareSend(const SignalHeader * const signalHeader,
Uint8 prio,
const Uint32 * const signalData,
NodeId nodeId,
class SectionSegmentPool & thePool,
const SegmentedSectionPtr ptr[3]){
Transporter *t = theTransporters[nodeId];
if(t != NULL &&
(((ioStates[nodeId] != HaltOutput) && (ioStates[nodeId] != HaltIO)) ||
((signalHeader->theReceiversBlockNumber == 252)||
(signalHeader->theReceiversBlockNumber == 4002)))) {
if(t->isConnected()){
Uint32 lenBytes = t->m_packer.getMessageLength(signalHeader, ptr);
if(lenBytes <= MAX_MESSAGE_SIZE){
Uint32 * insertPtr = t->getWritePtr(lenBytes, prio);
if(insertPtr != 0){
t->m_packer.pack(insertPtr, prio, signalHeader, signalData, thePool, ptr);
t->updateWritePtr(lenBytes, prio);
return SEND_OK;
}
/**
* @note: on linux/i386 the granularity is 10ms
* so sleepTime = 2 generates a 10 ms sleep.
*/
int sleepTime = 2;
for(int i = 0; i<50; i++){
if((nSHMTransporters+nSCITransporters) == 0)
NdbSleep_MilliSleep(sleepTime);
insertPtr = t->getWritePtr(lenBytes, prio);
if(insertPtr != 0){
t->m_packer.pack(insertPtr, prio, signalHeader, signalData, thePool, ptr);
t->updateWritePtr(lenBytes, prio);
break;
}
}
if(insertPtr != 0){
/**
* Send buffer full, but resend works
*/
reportError(callbackObj, nodeId, TE_SEND_BUFFER_FULL);
return SEND_OK;
}
WARNING("Signal to " << nodeId << " lost(buffer)");
reportError(callbackObj, nodeId, TE_SIGNAL_LOST_SEND_BUFFER_FULL);
return SEND_BUFFER_FULL;
} else {
return SEND_MESSAGE_TOO_BIG;
}
} else {
DEBUG("Signal to " << nodeId << " lost(disconnect) ");
return SEND_DISCONNECTED;
}
} else {
DEBUG("Discarding message to block: "
<< signalHeader->theReceiversBlockNumber
<< " node: " << nodeId);
if(t == NULL)
return SEND_UNKNOWN_NODE;
return SEND_BLOCKED;
}
}