Skip to content

Commit e947025

Browse files
committed
Refs #21690. Add implementation for update_endpoint_locators_if_default_nts.
Signed-off-by: Miguel Company <[email protected]>
1 parent 4401cb1 commit e947025

File tree

1 file changed

+51
-4
lines changed
  • src/cpp/rtps/builtin/discovery/participant

1 file changed

+51
-4
lines changed

src/cpp/rtps/builtin/discovery/participant/PDP.cpp

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,10 +1754,57 @@ void PDP::update_endpoint_locators_if_default_nts(
17541754
const RTPSParticipantAttributes& old_atts,
17551755
const RTPSParticipantAttributes& new_atts)
17561756
{
1757-
static_cast<void>(writers);
1758-
static_cast<void>(readers);
1759-
static_cast<void>(old_atts);
1760-
static_cast<void>(new_atts);
1757+
const auto& old_default_unicast = old_atts.defaultUnicastLocatorList;
1758+
const auto& new_default_unicast = new_atts.defaultUnicastLocatorList;
1759+
1760+
// Early return if there is no change in default unicast locators
1761+
if (old_default_unicast == new_default_unicast)
1762+
{
1763+
return;
1764+
}
1765+
1766+
// Update proxies of endpoints with no configured locators
1767+
EDP* edp = get_edp();
1768+
for (BaseWriter* writer : writers)
1769+
{
1770+
if (writer->getAttributes().multicastLocatorList.empty() &&
1771+
writer->getAttributes().unicastLocatorList.empty())
1772+
{
1773+
WriterProxyData* wdata = nullptr;
1774+
GUID_t participant_guid;
1775+
wdata = addWriterProxyData(writer->getGuid(), participant_guid,
1776+
[](WriterProxyData* proxy, bool is_update, const ParticipantProxyData& participant)
1777+
{
1778+
static_cast<void>(is_update);
1779+
assert(is_update);
1780+
1781+
proxy->set_locators(participant.default_locators);
1782+
return true;
1783+
});
1784+
assert(wdata != nullptr);
1785+
edp->process_writer_proxy_data(writer, wdata);
1786+
}
1787+
}
1788+
for (BaseReader* reader : readers)
1789+
{
1790+
if (reader->getAttributes().multicastLocatorList.empty() &&
1791+
reader->getAttributes().unicastLocatorList.empty())
1792+
{
1793+
ReaderProxyData* rdata = nullptr;
1794+
GUID_t participant_guid;
1795+
rdata = addReaderProxyData(reader->getGuid(), participant_guid,
1796+
[](ReaderProxyData* proxy, bool is_update, const ParticipantProxyData& participant)
1797+
{
1798+
static_cast<void>(is_update);
1799+
assert(is_update);
1800+
1801+
proxy->set_locators(participant.default_locators);
1802+
return true;
1803+
});
1804+
assert(rdata != nullptr);
1805+
edp->process_reader_proxy_data(reader, rdata);
1806+
}
1807+
}
17611808
}
17621809

17631810
} /* namespace rtps */

0 commit comments

Comments
 (0)