mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 09:31:45 +00:00
Update multi-part features (nanomsg) and various fixes
- Implement nanomsg multipart with MessagePack. - Use the MessagePack from FairSoft and handle not found case. - Update splitter, merger and proxy devices to handle multi-part. - Let FairMQParts.At() return pointer reference (can be used for moving). - Add missing const specifier in the message interface. - Add transmit kernel size setting to channels (ZMQ_SNDBUF). - Remove FairMQBuffer device. - Remove old multi-part methods from Tutorial3 example (to be replaced with Parts API). - Make callback mandatory for newMsg(data, size, callback). - Add missing <vector> include in FairMQSocket.
This commit is contained in:
@@ -29,22 +29,12 @@ FairMQMerger::~FairMQMerger()
|
||||
|
||||
void FairMQMerger::Run()
|
||||
{
|
||||
// store the channel references to avoid traversing the map on every loop iteration
|
||||
auto& dataInChannelRef = fChannels.at("data-in");
|
||||
const FairMQChannel& dataOutChannel = fChannels.at("data-out").at(0);
|
||||
int numInputs = dataInChannelRef.size();
|
||||
std::vector<FairMQChannel*> dataInChannels(numInputs);
|
||||
for (int i = 0; i < numInputs; ++i)
|
||||
{
|
||||
dataInChannels.at(i) = &(dataInChannelRef.at(i));
|
||||
}
|
||||
int numInputs = fChannels.at("data-in").size();
|
||||
|
||||
std::unique_ptr<FairMQPoller> poller(fTransportFactory->CreatePoller(dataInChannelRef));
|
||||
std::unique_ptr<FairMQPoller> poller(fTransportFactory->CreatePoller(fChannels.at("data-in")));
|
||||
|
||||
while (CheckCurrentState(RUNNING))
|
||||
{
|
||||
std::unique_ptr<FairMQMessage> msg(fTransportFactory->CreateMessage());
|
||||
|
||||
poller->Poll(100);
|
||||
|
||||
// Loop over the data input channels.
|
||||
@@ -53,19 +43,19 @@ void FairMQMerger::Run()
|
||||
// Check if the channel has data ready to be received.
|
||||
if (poller->CheckInput(i))
|
||||
{
|
||||
// Try receiving the data.
|
||||
if (dataInChannels[i]->Receive(msg) >= 0)
|
||||
FairMQParts parts;
|
||||
|
||||
if (Receive(parts, "data-in", i) >= 0)
|
||||
{
|
||||
// If data was received, send it to output.
|
||||
if (dataOutChannel.Send(msg) < 0)
|
||||
if (Send(parts, "data-out") < 0)
|
||||
{
|
||||
LOG(DEBUG) << "Blocking send interrupted by a command";
|
||||
LOG(DEBUG) << "Transfer interrupted";
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(DEBUG) << "Blocking receive interrupted by a command";
|
||||
LOG(DEBUG) << "Transfer interrupted";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user