From 008be36125644cca5f7e268b0265cae6473a68fb Mon Sep 17 00:00:00 2001 From: Dennis Klein Date: Sun, 28 Jul 2019 11:56:02 +0200 Subject: [PATCH] PluginServices: Do not throw if device control cannot be released --- fairmq/PluginServices.cxx | 3 ++- fairmq/plugins/DDS/DDS.h | 3 +++ fairmq/plugins/DDS/runDDSCommandUI.cxx | 2 +- test/plugin_services/_control.cxx | 5 +---- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/fairmq/PluginServices.cxx b/fairmq/PluginServices.cxx index d7f1f4c8..283048e7 100644 --- a/fairmq/PluginServices.cxx +++ b/fairmq/PluginServices.cxx @@ -74,7 +74,8 @@ auto PluginServices::ReleaseDeviceControl(const string& controller) -> void if (fDeviceController == controller) { fDeviceController = boost::none; } else { - throw DeviceControlError{tools::ToString("Plugin '", controller, "' cannot release control because it has not taken over control.")}; + LOG(debug) << "Plugin '" << controller << "' cannot release control " + << "because it has no control."; } } diff --git a/fairmq/plugins/DDS/DDS.h b/fairmq/plugins/DDS/DDS.h index 84225511..3a1aa448 100644 --- a/fairmq/plugins/DDS/DDS.h +++ b/fairmq/plugins/DDS/DDS.h @@ -63,6 +63,9 @@ struct DDSSubscription LOG(error) << "DDS Error received: error code: " << errorCode << ", error message: " << errorMsg; }); + // fDDSCustomCmd.subscribe([](const std::string& cmd, const std::string& cond, uint64_t senderId) { + // LOG(debug) << "cmd: " << cmd << ", cond: " << cond << ", senderId: " << senderId; + // }); assert(!dds_session_id.empty()); } diff --git a/fairmq/plugins/DDS/runDDSCommandUI.cxx b/fairmq/plugins/DDS/runDDSCommandUI.cxx index 7ad31829..925003f0 100644 --- a/fairmq/plugins/DDS/runDDSCommandUI.cxx +++ b/fairmq/plugins/DDS/runDDSCommandUI.cxx @@ -273,7 +273,7 @@ int main(int argc, char* argv[]) cerr << "state-changes-unsubscription failed with return code: " << parts[2]; } } else { - // cout << "Received: " << msg << endl; + cout << "Received: " << msg << endl; } }); diff --git a/test/plugin_services/_control.cxx b/test/plugin_services/_control.cxx index 6846d89b..222f7306 100644 --- a/test/plugin_services/_control.cxx +++ b/test/plugin_services/_control.cxx @@ -26,10 +26,7 @@ TEST_F(PluginServices, OnlySingleController) mServices.ChangeDeviceState("bar", DeviceStateTransition::InitDevice), fair::mq::PluginServices::DeviceControlError ); - ASSERT_THROW( // no control for bar - mServices.ReleaseDeviceControl("bar"), - fair::mq::PluginServices::DeviceControlError - ); + ASSERT_NO_THROW(mServices.ReleaseDeviceControl("bar")); ASSERT_NO_THROW(mServices.ReleaseDeviceControl("foo")); ASSERT_FALSE(mServices.GetDeviceController());