From 6af9f917a07068457ca57e54b74a59e4ed34b905 Mon Sep 17 00:00:00 2001 From: Adam Mitz Date: Thu, 19 Sep 2024 18:19:31 +0000 Subject: [PATCH] simplifications and clarifications --- tools/rtpsrelay/RelayHandler.cpp | 14 ++++++-------- tools/rtpsrelay/RelayHandler.h | 2 +- tools/rtpsrelay/RtpsRelay.cpp | 6 +++--- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/tools/rtpsrelay/RelayHandler.cpp b/tools/rtpsrelay/RelayHandler.cpp index f04f4e1985d..bcadf013d82 100644 --- a/tools/rtpsrelay/RelayHandler.cpp +++ b/tools/rtpsrelay/RelayHandler.cpp @@ -406,7 +406,7 @@ CORBA::ULong VerticalHandler::process_message(const ACE_INET_Addr& remote_addres break; } - CORBA::ULong sent = bytes_sent ? 0 : 1; + CORBA::ULong messages_sent = bytes_sent ? 0 : 1; if (has_guid) { GuidAddrSet::Proxy proxy(guid_addr_set_); @@ -423,11 +423,11 @@ CORBA::ULong VerticalHandler::process_message(const ACE_INET_Addr& remote_addres bool admitted = false; proxy.ignore_rtps(from_application_participant, src_guid, now, admitted); if (admitted && spdp_handler_) { - sent += spdp_handler_->send_to_application_participant(proxy, src_guid, now); + messages_sent += spdp_handler_->send_to_application_participant(proxy, src_guid, now); } } - return sent; + return messages_sent; } } @@ -717,16 +717,14 @@ CORBA::ULong HorizontalHandler::process_message(const ACE_INET_Addr& from, } const size_t size_after_header = mp.remaining(); - msg->rd_ptr(size_before_header - size_after_header); - GuidAddrSet::Proxy proxy(vertical_handler_->guid_addr_set()); - - CORBA::ULong sent = 0; - GuidSet guids; const auto to_guids = relay_guids_to_set(relay_header.to_guids()); + guid_partition_table_.lookup(guids, relay_header.to_partitions(), to_guids); + GuidAddrSet::Proxy proxy(vertical_handler_->guid_addr_set()); + CORBA::ULong sent = 0; for (const auto& guid : guids) { const auto p = proxy.find(guid); if (p != proxy.end()) { diff --git a/tools/rtpsrelay/RelayHandler.h b/tools/rtpsrelay/RelayHandler.h index 1a109461e42..8f6e283b002 100644 --- a/tools/rtpsrelay/RelayHandler.h +++ b/tools/rtpsrelay/RelayHandler.h @@ -90,7 +90,7 @@ class RelayHandler : public ACE_Event_Handler { class HorizontalHandler; class SpdpHandler; -// Sends to and receives from peers. +// Sends to and receives from applications. class VerticalHandler : public RelayHandler { public: VerticalHandler(const Config& config, diff --git a/tools/rtpsrelay/RtpsRelay.cpp b/tools/rtpsrelay/RtpsRelay.cpp index 2b68afde216..f1946bb57ca 100644 --- a/tools/rtpsrelay/RtpsRelay.cpp +++ b/tools/rtpsrelay/RtpsRelay.cpp @@ -49,7 +49,7 @@ namespace { void append(DDS::PropertySeq& props, const char* name, const std::string& value, bool propagate = false) { const DDS::Property_t prop = {name, value.c_str(), propagate}; - const unsigned int len = props.length(); + const auto len = props.length(); props.length(len + 1); try { props[len] = prop; @@ -63,7 +63,7 @@ namespace { std::vector nics; OpenDDS::DCPS::get_interface_addrs(nics); - for (auto nic : nics) { + for (auto& nic : nics) { if (nic.is_loopback()) { continue; } @@ -269,7 +269,7 @@ int run(int argc, ACE_TCHAR* argv[]) } if (!meta_discovery_content_path.empty()) { - std::ifstream in(meta_discovery_content_path.c_str()); + std::ifstream in(meta_discovery_content_path); if (!in) { ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: Could not open %C\n", meta_discovery_content_path.c_str())); return EXIT_FAILURE;