Move node() == nullptr check into //aos:configuration
This simplifies the code surprisingly significantly for dealing with
single node systems.
Change-Id: Ib317e16a9055fbf1341a194120a5b34f05b2d8f8
diff --git a/aos/events/shm_event_loop.cc b/aos/events/shm_event_loop.cc
index 0ca713f..e30e2f2 100644
--- a/aos/events/shm_event_loop.cc
+++ b/aos/events/shm_event_loop.cc
@@ -550,14 +550,11 @@
::std::unique_ptr<RawFetcher> ShmEventLoop::MakeRawFetcher(
const Channel *channel) {
-
- if (node() != nullptr) {
- if (!configuration::ChannelIsReadableOnNode(channel, node())) {
- LOG(FATAL) << "Channel { \"name\": \"" << channel->name()->string_view()
- << "\", \"type\": \"" << channel->type()->string_view()
- << "\" } is not able to be fetched on this node. Check your "
- "configuration.";
- }
+ if (!configuration::ChannelIsReadableOnNode(channel, node())) {
+ LOG(FATAL) << "Channel { \"name\": \"" << channel->name()->string_view()
+ << "\", \"type\": \"" << channel->type()->string_view()
+ << "\" } is not able to be fetched on this node. Check your "
+ "configuration.";
}
return ::std::unique_ptr<RawFetcher>(new internal::ShmFetcher(this, channel));
@@ -575,13 +572,11 @@
std::function<void(const Context &context, const void *message)> watcher) {
Take(channel);
- if (node() != nullptr) {
- if (!configuration::ChannelIsReadableOnNode(channel, node())) {
- LOG(FATAL) << "Channel { \"name\": \"" << channel->name()->string_view()
- << "\", \"type\": \"" << channel->type()->string_view()
- << "\" } is not able to be watched on this node. Check your "
- "configuration.";
- }
+ if (!configuration::ChannelIsReadableOnNode(channel, node())) {
+ LOG(FATAL) << "Channel { \"name\": \"" << channel->name()->string_view()
+ << "\", \"type\": \"" << channel->type()->string_view()
+ << "\" } is not able to be watched on this node. Check your "
+ "configuration.";
}
NewWatcher(::std::unique_ptr<WatcherState>(