Enable new callback API

- OnData() channel data handler.
 - ConditionalRun() for devices without incoming data.
 - Header file with common main(), to be extended with getDevice/addCustomOptions.
 - Update examples (MQ/Tutorial3) to use the new API and config.
 - NewSimpleMessage() for simpler creation of small messages (additional copy).
 - Replace SetProperty/GetProperty with fConfig access.
 - Runtime configurable channel names for common devices.
 - Configurable logging interval per channel.
 - FairMQMultiplier for distributing same data to multiple outputs.
 - Cleanup state machine messages.
 - Cmd option to toggle signal handling.
 - Simpler API for send/receive timeouts.
 - Enable --log-to-file.
 - Fix coverity issues, warnings.
 - Various code cleanup and minor tweaks.
This commit is contained in:
Alexey Rybalchenko
2016-08-10 09:47:53 +02:00
parent e0a03242ac
commit 16fd63cd5b
54 changed files with 1730 additions and 1665 deletions

View File

@@ -24,65 +24,35 @@ class TransferTimeoutTester : public FairMQDevice
protected:
virtual void Run()
{
// bool setSndOK = false;
// bool setRcvOK = false;
bool getSndOK = false;
bool getRcvOK = false;
bool sendCanceling = false;
bool receiveCanceling = false;
fChannels.at("data-out").at(0).SetSendTimeout(1000);
fChannels.at("data-in").at(0).SetReceiveTimeout(1000);
FairMQMessagePtr msg1(NewMessage());
FairMQMessagePtr msg2(NewMessage());
if (fChannels.at("data-out").at(0).GetSendTimeout() == 1000)
if (Send(msg1, "data-out", 0, 1000) == -2)
{
getSndOK = true;
LOG(INFO) << "get send timeout OK: " << fChannels.at("data-out").at(0).GetSendTimeout();
LOG(INFO) << "send canceled";
sendCanceling = true;
}
else
{
LOG(ERROR) << "get send timeout failed";
LOG(ERROR) << "send did not cancel";
}
if (fChannels.at("data-in").at(0).GetReceiveTimeout() == 1000)
if (Receive(msg2, "data-in", 0, 1000) == -2)
{
getRcvOK = true;
LOG(INFO) << "get receive timeout OK: " << fChannels.at("data-in").at(0).GetReceiveTimeout();
LOG(INFO) << "receive canceled";
receiveCanceling = true;
}
else
{
LOG(ERROR) << "get receive timeout failed";
LOG(ERROR) << "receive did not cancel";
}
if (getSndOK && getRcvOK)
if (sendCanceling && receiveCanceling)
{
std::unique_ptr<FairMQMessage> msg1(NewMessage());
std::unique_ptr<FairMQMessage> msg2(NewMessage());
if (Send(msg1, "data-out") == -2)
{
LOG(INFO) << "send canceled";
sendCanceling = true;
}
else
{
LOG(ERROR) << "send did not cancel";
}
if (Receive(msg2, "data-in") == -2)
{
LOG(INFO) << "receive canceled";
receiveCanceling = true;
}
else
{
LOG(ERROR) << "receive did not cancel";
}
if (sendCanceling && receiveCanceling)
{
LOG(INFO) << "Transfer timeout test successfull";
}
LOG(INFO) << "Transfer timeout test successfull";
}
}
};