mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 17:41:45 +00:00
Check return values of Receive calls in the examples
This commit is contained in:
committed by
Mohammad Al-Turany
parent
6dc4dc84b3
commit
4be6ba6e66
@@ -30,9 +30,10 @@ void FairMQExample4Sink::Run()
|
||||
{
|
||||
std::unique_ptr<FairMQMessage> msg(fTransportFactory->CreateMessage());
|
||||
|
||||
fChannels.at("data-in").at(0).Receive(msg);
|
||||
|
||||
LOG(INFO) << "Received message: \"" << *(static_cast<int*>(msg->GetData())) << "\"";
|
||||
if (fChannels.at("data-in").at(0).Receive(msg) >= 0)
|
||||
{
|
||||
LOG(INFO) << "Received message: \"" << *(static_cast<int*>(msg->GetData())) << "\"";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -49,10 +49,11 @@ void FairMQExample5Client::Run()
|
||||
|
||||
if (fChannels.at("data").at(0).Send(request) > 0)
|
||||
{
|
||||
fChannels.at("data").at(0).Receive(reply);
|
||||
LOG(INFO) << "Received reply from server: \"" << string(static_cast<char*>(reply->GetData()), reply->GetSize()) << "\"";
|
||||
if (fChannels.at("data").at(0).Receive(reply) >= 0)
|
||||
{
|
||||
LOG(INFO) << "Received reply from server: \"" << string(static_cast<char*>(reply->GetData()), reply->GetSize()) << "\"";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user