|
66 | 66 | #include <mutex>
|
67 | 67 | #include <chrono>
|
68 | 68 |
|
| 69 | +<<<<<<< HEAD |
| 70 | +======= |
| 71 | +#include <fastdds/config.hpp> |
| 72 | +#include <fastdds/dds/domain/DomainParticipant.hpp> |
| 73 | +#include <fastdds/dds/domain/DomainParticipantFactory.hpp> |
| 74 | +#include <fastdds/dds/log/Log.hpp> |
| 75 | +#include <fastdds/dds/topic/TypeSupport.hpp> |
| 76 | +#include <fastdds/rtps/builtin/data/BuiltinEndpoints.hpp> |
| 77 | +#include <fastdds/rtps/builtin/data/ParticipantBuiltinTopicData.hpp> |
| 78 | +#include <fastdds/rtps/common/LocatorList.hpp> |
| 79 | +#include <fastdds/rtps/history/ReaderHistory.hpp> |
| 80 | +#include <fastdds/rtps/history/WriterHistory.hpp> |
| 81 | +#include <fastdds/rtps/participant/RTPSParticipantListener.hpp> |
| 82 | +#include <fastdds/rtps/reader/ReaderDiscoveryStatus.hpp> |
| 83 | +#include <fastdds/rtps/writer/WriterDiscoveryStatus.hpp> |
| 84 | +#include <fastdds/utils/IPLocator.hpp> |
| 85 | + |
| 86 | +#include <fastdds/builtin/type_lookup_service/TypeLookupManager.hpp> |
| 87 | +#include <fastdds/utils/TypePropagation.hpp> |
| 88 | +#include <rtps/builtin/BuiltinProtocols.h> |
| 89 | +#include <rtps/builtin/data/ParticipantProxyData.hpp> |
| 90 | +#include <rtps/builtin/data/ProxyDataConverters.hpp> |
| 91 | +#include <rtps/builtin/data/ProxyHashTables.hpp> |
| 92 | +#include <rtps/builtin/data/ReaderProxyData.hpp> |
| 93 | +#include <rtps/builtin/data/WriterProxyData.hpp> |
| 94 | +#include <rtps/builtin/discovery/endpoint/EDPSimple.h> |
| 95 | +#include <rtps/builtin/discovery/endpoint/EDPStatic.h> |
| 96 | +#include <rtps/builtin/discovery/participant/PDPEndpoints.hpp> |
| 97 | +#include <rtps/builtin/discovery/participant/PDPListener.h> |
| 98 | +#include <rtps/builtin/liveliness/WLP.hpp> |
| 99 | +#include <rtps/history/TopicPayloadPoolRegistry.hpp> |
| 100 | +#include <rtps/network/utils/external_locators.hpp> |
| 101 | +#include <rtps/participant/RTPSParticipantImpl.h> |
| 102 | +#include <rtps/reader/StatefulReader.hpp> |
| 103 | +#include <rtps/reader/StatelessReader.hpp> |
| 104 | +#include <rtps/resources/TimedEvent.h> |
| 105 | +#include <rtps/writer/StatelessWriter.hpp> |
| 106 | +#if HAVE_SECURITY |
| 107 | +#include <rtps/security/accesscontrol/ParticipantSecurityAttributes.h> |
| 108 | +#endif // if HAVE_SECURITY |
| 109 | +#include <utils/shared_mutex.hpp> |
| 110 | +#include <utils/TimeConversion.hpp> |
| 111 | +#include <rtps/writer/BaseWriter.hpp> |
| 112 | +#include <rtps/reader/BaseReader.hpp> |
| 113 | + |
| 114 | +>>>>>>> 91bd7c857 (Fix issues in Dynamic Network Interfaces (#5282)) |
69 | 115 | namespace eprosima {
|
70 | 116 | namespace fastrtps {
|
71 | 117 | namespace rtps {
|
@@ -1662,6 +1708,121 @@ void PDP::add_builtin_security_attributes(
|
1662 | 1708 |
|
1663 | 1709 | #endif // HAVE_SECURITY
|
1664 | 1710 |
|
| 1711 | +void PDP::local_participant_attributes_update_nts( |
| 1712 | + const RTPSParticipantAttributes& new_atts) |
| 1713 | +{ |
| 1714 | + // Update user data |
| 1715 | + auto participant_data = getLocalParticipantProxyData(); |
| 1716 | + participant_data->m_userData.data_vec(new_atts.userData); |
| 1717 | + |
| 1718 | + // If we are intraprocess only, we do not need to update locators |
| 1719 | + bool announce_locators = !mp_RTPSParticipant->is_intraprocess_only(); |
| 1720 | + if (announce_locators) |
| 1721 | + { |
| 1722 | + // Clear all locators |
| 1723 | + participant_data->metatraffic_locators.unicast.clear(); |
| 1724 | + participant_data->metatraffic_locators.multicast.clear(); |
| 1725 | + participant_data->default_locators.unicast.clear(); |
| 1726 | + participant_data->default_locators.multicast.clear(); |
| 1727 | + |
| 1728 | + // Update default locators |
| 1729 | + for (const Locator_t& loc : new_atts.defaultUnicastLocatorList) |
| 1730 | + { |
| 1731 | + participant_data->default_locators.add_unicast_locator(loc); |
| 1732 | + } |
| 1733 | + for (const Locator_t& loc : new_atts.defaultMulticastLocatorList) |
| 1734 | + { |
| 1735 | + participant_data->default_locators.add_multicast_locator(loc); |
| 1736 | + } |
| 1737 | + |
| 1738 | + // Update metatraffic locators |
| 1739 | + for (const auto& locator : new_atts.builtin.metatrafficUnicastLocatorList) |
| 1740 | + { |
| 1741 | + participant_data->metatraffic_locators.add_unicast_locator(locator); |
| 1742 | + } |
| 1743 | + if (!new_atts.builtin.avoid_builtin_multicast || participant_data->metatraffic_locators.unicast.empty()) |
| 1744 | + { |
| 1745 | + for (const auto& locator : new_atts.builtin.metatrafficMulticastLocatorList) |
| 1746 | + { |
| 1747 | + participant_data->metatraffic_locators.add_multicast_locator(locator); |
| 1748 | + } |
| 1749 | + } |
| 1750 | + |
| 1751 | + fastdds::rtps::network::external_locators::add_external_locators(*participant_data, |
| 1752 | + new_atts.builtin.metatraffic_external_unicast_locators, |
| 1753 | + new_atts.default_external_unicast_locators); |
| 1754 | + } |
| 1755 | +} |
| 1756 | + |
| 1757 | +void PDP::update_endpoint_locators_if_default_nts( |
| 1758 | + const std::vector<BaseWriter*>& writers, |
| 1759 | + const std::vector<BaseReader*>& readers, |
| 1760 | + const RTPSParticipantAttributes& old_atts, |
| 1761 | + const RTPSParticipantAttributes& new_atts) |
| 1762 | +{ |
| 1763 | + // Check if default locators have changed |
| 1764 | + const auto& old_default_unicast = old_atts.defaultUnicastLocatorList; |
| 1765 | + const auto& old_default_multicast = old_atts.defaultMulticastLocatorList; |
| 1766 | + const auto& new_default_unicast = new_atts.defaultUnicastLocatorList; |
| 1767 | + const auto& new_default_multicast = new_atts.defaultMulticastLocatorList; |
| 1768 | + |
| 1769 | + // Early return if there is no change in default unicast locators |
| 1770 | + if ((old_default_unicast == new_default_unicast) && |
| 1771 | + (old_default_multicast == new_default_multicast)) |
| 1772 | + { |
| 1773 | + return; |
| 1774 | + } |
| 1775 | + |
| 1776 | + // Update proxies of endpoints with default configured locators |
| 1777 | + EDP* edp = get_edp(); |
| 1778 | + for (BaseWriter* writer : writers) |
| 1779 | + { |
| 1780 | + if ((old_default_multicast == writer->getAttributes().multicastLocatorList) && |
| 1781 | + (old_default_unicast == writer->getAttributes().unicastLocatorList)) |
| 1782 | + { |
| 1783 | + writer->getAttributes().multicastLocatorList = new_default_multicast; |
| 1784 | + writer->getAttributes().unicastLocatorList = new_default_unicast; |
| 1785 | + |
| 1786 | + WriterProxyData* wdata = nullptr; |
| 1787 | + GUID_t participant_guid; |
| 1788 | + wdata = addWriterProxyData(writer->getGuid(), participant_guid, |
| 1789 | + [](WriterProxyData* proxy, bool is_update, const ParticipantProxyData& participant) |
| 1790 | + { |
| 1791 | + static_cast<void>(is_update); |
| 1792 | + assert(is_update); |
| 1793 | + |
| 1794 | + proxy->set_locators(participant.default_locators); |
| 1795 | + return true; |
| 1796 | + }); |
| 1797 | + assert(wdata != nullptr); |
| 1798 | + edp->process_writer_proxy_data(writer, wdata); |
| 1799 | + } |
| 1800 | + } |
| 1801 | + for (BaseReader* reader : readers) |
| 1802 | + { |
| 1803 | + if ((old_default_multicast == reader->getAttributes().multicastLocatorList) && |
| 1804 | + (old_default_unicast == reader->getAttributes().unicastLocatorList)) |
| 1805 | + { |
| 1806 | + reader->getAttributes().multicastLocatorList = new_default_multicast; |
| 1807 | + reader->getAttributes().unicastLocatorList = new_default_unicast; |
| 1808 | + |
| 1809 | + ReaderProxyData* rdata = nullptr; |
| 1810 | + GUID_t participant_guid; |
| 1811 | + rdata = addReaderProxyData(reader->getGuid(), participant_guid, |
| 1812 | + [](ReaderProxyData* proxy, bool is_update, const ParticipantProxyData& participant) |
| 1813 | + { |
| 1814 | + static_cast<void>(is_update); |
| 1815 | + assert(is_update); |
| 1816 | + |
| 1817 | + proxy->set_locators(participant.default_locators); |
| 1818 | + return true; |
| 1819 | + }); |
| 1820 | + assert(rdata != nullptr); |
| 1821 | + edp->process_reader_proxy_data(reader, rdata); |
| 1822 | + } |
| 1823 | + } |
| 1824 | +} |
| 1825 | + |
1665 | 1826 | } /* namespace rtps */
|
1666 | 1827 | } /* namespace fastrtps */
|
1667 | 1828 | } /* namespace eprosima */
|
0 commit comments