Skip to content

Commit

Permalink
simplifications and clarifications
Browse files Browse the repository at this point in the history
  • Loading branch information
mitza-oci committed Sep 19, 2024
1 parent d2fdb00 commit 6af9f91
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
14 changes: 6 additions & 8 deletions tools/rtpsrelay/RelayHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_);
Expand All @@ -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;
}
}

Expand Down Expand Up @@ -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()) {
Expand Down
2 changes: 1 addition & 1 deletion tools/rtpsrelay/RelayHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions tools/rtpsrelay/RtpsRelay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -63,7 +63,7 @@ namespace {
std::vector<ACE_INET_Addr> nics;
OpenDDS::DCPS::get_interface_addrs(nics);

for (auto nic : nics) {
for (auto& nic : nics) {
if (nic.is_loopback()) {
continue;
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6af9f91

Please sign in to comment.