@@ -1754,10 +1754,57 @@ void PDP::update_endpoint_locators_if_default_nts(
1754
1754
const RTPSParticipantAttributes& old_atts,
1755
1755
const RTPSParticipantAttributes& new_atts)
1756
1756
{
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
+ }
1761
1808
}
1762
1809
1763
1810
} /* namespace rtps */
0 commit comments