FairMQ: allow accumulation of parts on receive.

This commit is contained in:
Alexey Rybalchenko
2017-04-27 14:05:02 +02:00
committed by Mohammad Al-Turany
parent 1fa5c836a6
commit 0926a9a764
4 changed files with 26 additions and 27 deletions

View File

@@ -823,27 +823,26 @@ bool FairMQChannel::CheckCompatibility(unique_ptr<FairMQMessage>& msg) const
bool FairMQChannel::CheckCompatibility(vector<unique_ptr<FairMQMessage>>& msgVec) const
{
bool match = true;
if (msgVec.size() > 0)
{
if (fTransportType == msgVec.at(0)->GetType())
for (unsigned int i = 0; i < msgVec.size(); ++i)
{
return true;
}
else
{
// LOG(WARN) << "Channel type does not match message type. Copying...";
vector<unique_ptr<FairMQMessage>> tempVec;
for (unsigned int i = 0; i < msgVec.size(); ++i)
if (fTransportType != msgVec.at(i)->GetType())
{
tempVec.push_back(fTransportFactory->CreateMessage(msgVec[i]->GetSize()));
memcpy(tempVec[i]->GetData(), msgVec[i]->GetData(), msgVec[i]->GetSize());
// LOG(WARN) << "Channel type does not match message type. Copying...";
FairMQMessagePtr newMsg(fTransportFactory->CreateMessage(msgVec[i]->GetSize()));
memcpy(newMsg->GetData(), msgVec[i]->GetData(), msgVec[i]->GetSize());
msgVec[i] = move(newMsg);
match = false;
}
msgVec = move(tempVec);
return false;
}
}
else
{
return true;
}
return match;
}