mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 16:46:47 +00:00
PluginServices: Do not throw if device control cannot be released
This commit is contained in:
parent
93eb599df7
commit
008be36125
|
@ -74,7 +74,8 @@ auto PluginServices::ReleaseDeviceControl(const string& controller) -> void
|
||||||
if (fDeviceController == controller) {
|
if (fDeviceController == controller) {
|
||||||
fDeviceController = boost::none;
|
fDeviceController = boost::none;
|
||||||
} else {
|
} 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.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,9 @@ struct DDSSubscription
|
||||||
LOG(error) << "DDS Error received: error code: " << errorCode << ", error message: " << errorMsg;
|
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());
|
assert(!dds_session_id.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -273,7 +273,7 @@ int main(int argc, char* argv[])
|
||||||
cerr << "state-changes-unsubscription failed with return code: " << parts[2];
|
cerr << "state-changes-unsubscription failed with return code: " << parts[2];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// cout << "Received: " << msg << endl;
|
cout << "Received: " << msg << endl;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,7 @@ TEST_F(PluginServices, OnlySingleController)
|
||||||
mServices.ChangeDeviceState("bar", DeviceStateTransition::InitDevice),
|
mServices.ChangeDeviceState("bar", DeviceStateTransition::InitDevice),
|
||||||
fair::mq::PluginServices::DeviceControlError
|
fair::mq::PluginServices::DeviceControlError
|
||||||
);
|
);
|
||||||
ASSERT_THROW( // no control for bar
|
ASSERT_NO_THROW(mServices.ReleaseDeviceControl("bar"));
|
||||||
mServices.ReleaseDeviceControl("bar"),
|
|
||||||
fair::mq::PluginServices::DeviceControlError
|
|
||||||
);
|
|
||||||
|
|
||||||
ASSERT_NO_THROW(mServices.ReleaseDeviceControl("foo"));
|
ASSERT_NO_THROW(mServices.ReleaseDeviceControl("foo"));
|
||||||
ASSERT_FALSE(mServices.GetDeviceController());
|
ASSERT_FALSE(mServices.GetDeviceController());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user