Skip to content

Commit

Permalink
Refs #18002. Safe metatraffic unicast port on a new attribute.
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
  • Loading branch information
MiguelCompany committed Mar 12, 2024
1 parent 9ff52b2 commit ba5ebc6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/cpp/rtps/participant/RTPSParticipantImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,7 @@ void RTPSParticipantImpl::setup_meta_traffic()

// Creation of metatraffic locator and receiver resources
uint32_t metatraffic_multicast_port = m_att.port.getMulticastPort(domain_id_);
uint32_t metatraffic_unicast_port = m_att.port.getUnicastPort(domain_id_,
static_cast<uint32_t>(m_att.participantID));
metatraffic_unicast_port_ = m_att.port.getUnicastPort(domain_id_, static_cast<uint32_t>(m_att.participantID));
uint32_t meta_multicast_port_for_check = metatraffic_multicast_port;

/* INSERT DEFAULT MANDATORY MULTICAST LOCATORS HERE */
Expand All @@ -450,7 +449,7 @@ void RTPSParticipantImpl::setup_meta_traffic()
std::for_each(m_att.builtin.metatrafficUnicastLocatorList.begin(),
m_att.builtin.metatrafficUnicastLocatorList.end(), [&](Locator_t& locator)
{
m_network_Factory.fillMetatrafficUnicastLocator(locator, metatraffic_unicast_port);
m_network_Factory.fillMetatrafficUnicastLocator(locator, metatraffic_unicast_port_);
});
m_network_Factory.NormalizeLocators(m_att.builtin.metatrafficUnicastLocatorList);
}
Expand Down Expand Up @@ -2642,15 +2641,13 @@ void RTPSParticipantImpl::environment_file_has_changed()
void RTPSParticipantImpl::get_default_metatraffic_locators()
{
uint32_t metatraffic_multicast_port = m_att.port.getMulticastPort(domain_id_);
uint32_t metatraffic_unicast_port = m_att.port.getUnicastPort(domain_id_,
static_cast<uint32_t>(m_att.participantID));

m_network_Factory.getDefaultMetatrafficMulticastLocators(m_att.builtin.metatrafficMulticastLocatorList,
metatraffic_multicast_port);
m_network_Factory.NormalizeLocators(m_att.builtin.metatrafficMulticastLocatorList);

m_network_Factory.getDefaultMetatrafficUnicastLocators(m_att.builtin.metatrafficUnicastLocatorList,
metatraffic_unicast_port);
metatraffic_unicast_port_);
m_network_Factory.NormalizeLocators(m_att.builtin.metatrafficUnicastLocatorList);
}

Expand Down
2 changes: 2 additions & 0 deletions src/cpp/rtps/participant/RTPSParticipantImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,8 @@ class RTPSParticipantImpl
uint32_t domain_id_;
//!Attributes of the RTPSParticipant
RTPSParticipantAttributes m_att;
//! Metatraffic unicast port used by default on this participant
uint32_t metatraffic_unicast_port_ = 0;
//!Guid of the RTPSParticipant.
GUID_t m_guid;
//! String containing the RTPSParticipant Guid.
Expand Down

0 comments on commit ba5ebc6

Please sign in to comment.