HLTDebug("source task %s (%p) does not provide any matching data type for task %s (%p)", pSrcTask->GetName(), pSrcTask, GetName(), this);
}
}
- if ((iResult=pSrcTask->Subscribe(this, &fBlockDataArray[iSourceDataBlock],fBlockDataArray.size()-iSourceDataBlock))>0) {
+ if ((iResult=pSrcTask->Subscribe(this, &fBlockDataArray[iSourceDataBlock],fBlockDataArray.size()-iSourceDataBlock))>=0) {
for (int i=0; i<iResult; i++) {
iInputDataVolume+=fBlockDataArray[i+iSourceDataBlock].fSize;
// put the source task as many times into the list as it provides data blocks
if (pTgtBuffer!=NULL || iOutputDataSize==0) {
iResult=pComponent->ProcessEvent(evtData, &fBlockDataArray[0], trigData, pTgtBuffer, size, outputBlockCnt, outputBlocks, edd);
HLTDebug("task %s: component %s ProcessEvent finnished (%d): size=%d blocks=%d", GetName(), pComponent->GetComponentID(), iResult, size, outputBlockCnt);
- if (iResult>=0 && pTgtBuffer) {
+ if (iResult>=0 && pTgtBuffer && outputBlocks) {
iResult=fpDataBuffer->SetSegments(pTgtBuffer, outputBlocks, outputBlockCnt);
delete [] outputBlocks; outputBlocks=NULL; outputBlockCnt=0;
} else {
{
// see header file for function documentation
int iResult=0;
+
+ // Matthias 26.09.2007 relax the restriction to matching data blocks
+ // all blocks are passed to the consumer, which is the policy also in
+ // PubSub
+ tgtList.assign(fSegments.begin(), fSegments.end());
+ iResult=tgtList.size();
+ return iResult;
+
if (pConsumer) {
vector<AliHLTComponentDataType> dtlist;
((AliHLTComponent*)pConsumer)->GetInputDataTypes(dtlist);
AliHLTConsumerDescriptor* pDesc=FindConsumer(pConsumer, fConsumers);
if (pDesc) {
vector<AliHLTDataBuffer::AliHLTDataSegment> tgtList;
- /* TODO: think about a good policy for this check
- * is it enough that at least one segment is available, or have all to be available?
- * or is it possible to have optional segments?
- */
- if ((iResult=FindMatchingDataSegments(pConsumer, tgtList))>0) {
+ // Matthias 26.07.2007 AliHLTSystem should behave the same way as PubSub
+ // so it does not matter if there are matching data types or not, unless
+ // we implement such a check in PubSub
+ if ((iResult=FindMatchingDataSegments(pConsumer, tgtList))>=0) {
int i =0;
vector<AliHLTDataBuffer::AliHLTDataSegment>::iterator segment=tgtList.begin();
while (segment!=tgtList.end() && i<iArraySize) {
i++;
segment++;
}
+ // check whether there was enough space for the segments
+ if (i!=tgtList.size()) {
+ HLTError("too little space in block descriptor array: required %d, available %d", tgtList.size(), iArraySize);
+ iResult=-ENOSPC;
+ } else {
// move this consumer to the active list
if (ChangeConsumerState(pDesc, fConsumers, fActiveConsumers)>=0) {
HLTDebug("component %p (%s) subscribed to data buffer %p", pConsumer, ((AliHLTComponent*)pConsumer)->GetComponentID(), this);
HLTError("can not activate consumer %p for data buffer %p", pConsumer, this);
iResult=-EACCES;
}
+ }
} else {
HLTError("unresolved data segment(s) for component %p (%s)", pConsumer, ((AliHLTComponent*)pConsumer)->GetComponentID());
iResult=-EBADF;
iResult=-ENOENT;
}
} else {
- HLTError("data buffer %p is empty", this);
- iResult=-ENODATA;
+ // Matthias 26.07.2007 until now, data had to be present for successful subscription
+ // in order to be consistent with the PubSub framework, this restiction has been
+ // removed
+ //HLTError("data buffer %p is empty", this);
+ //iResult=-ENODATA;
}
} else {
HLTError("invalid parameter");