24
24
#include < fastdds/rtps/common/CDRMessage_t.hpp>
25
25
#include < fastdds/rtps/common/VendorId_t.hpp>
26
26
27
+ #include < rtps/builtin/data/ParticipantProxyData.hpp>
27
28
#include < rtps/network/NetworkFactory.hpp>
29
+ #include < utils/SystemInfo.hpp>
28
30
29
31
#include " ProxyDataFilters.hpp"
30
32
@@ -647,11 +649,9 @@ bool ReaderProxyData::writeToCDRMessage(
647
649
648
650
bool ReaderProxyData::readFromCDRMessage (
649
651
CDRMessage_t* msg,
650
- NetworkFactory& network,
651
- bool should_filter_locators,
652
652
fastdds::rtps::VendorId_t source_vendor_id)
653
653
{
654
- auto param_process = [this , &network, &should_filter_locators, source_vendor_id](
654
+ auto param_process = [this , source_vendor_id](
655
655
CDRMessage_t* msg, const ParameterId_t& pid, uint16_t plength)
656
656
{
657
657
VendorId_t vendor_id = source_vendor_id;
@@ -889,23 +889,7 @@ bool ReaderProxyData::readFromCDRMessage(
889
889
return false ;
890
890
}
891
891
892
- if (!should_filter_locators)
893
- {
894
- remote_locators_.add_unicast_locator (p.locator );
895
- }
896
- else
897
- {
898
- Locator_t temp_locator;
899
- if (network.transform_remote_locator (p.locator , temp_locator, m_networkConfiguration,
900
- m_guid.is_from_this_host ()))
901
- {
902
- ProxyDataFilters::filter_locators (
903
- network,
904
- remote_locators_,
905
- temp_locator,
906
- true );
907
- }
908
- }
892
+ remote_locators_.add_unicast_locator (p.locator );
909
893
break ;
910
894
}
911
895
case fastdds::dds::PID_MULTICAST_LOCATOR:
@@ -917,23 +901,7 @@ bool ReaderProxyData::readFromCDRMessage(
917
901
return false ;
918
902
}
919
903
920
- if (!should_filter_locators)
921
- {
922
- remote_locators_.add_multicast_locator (p.locator );
923
- }
924
- else
925
- {
926
- Locator_t temp_locator;
927
- if (network.transform_remote_locator (p.locator , temp_locator, m_networkConfiguration,
928
- m_guid.is_from_this_host ()))
929
- {
930
- ProxyDataFilters::filter_locators (
931
- network,
932
- remote_locators_,
933
- temp_locator,
934
- false );
935
- }
936
- }
904
+ remote_locators_.add_unicast_locator (p.locator );
937
905
break ;
938
906
}
939
907
case fastdds::dds::PID_EXPECTS_INLINE_QOS:
@@ -1149,6 +1117,47 @@ bool ReaderProxyData::readFromCDRMessage(
1149
1117
return false ;
1150
1118
}
1151
1119
1120
+ void ReaderProxyData::setup_locators (
1121
+ const ReaderProxyData& rdata,
1122
+ NetworkFactory& network,
1123
+ const ParticipantProxyData& participant_data)
1124
+ {
1125
+ if (this == &rdata)
1126
+ {
1127
+ return ;
1128
+ }
1129
+
1130
+ bool from_this_host = participant_data.is_from_this_host ();
1131
+
1132
+ if (rdata.has_locators ())
1133
+ {
1134
+ // Get the transformed remote locators for the ReaderProxyData received
1135
+ remote_locators_.unicast .clear ();
1136
+ remote_locators_.multicast .clear ();
1137
+ for (const Locator_t& locator : rdata.remote_locators_ .unicast )
1138
+ {
1139
+ Locator_t temp_locator;
1140
+ if (network.transform_remote_locator (locator, temp_locator, m_networkConfiguration, from_this_host))
1141
+ {
1142
+ ProxyDataFilters::filter_locators (network, remote_locators_, temp_locator, true );
1143
+ }
1144
+ }
1145
+ for (const Locator_t& locator : rdata.remote_locators_ .multicast )
1146
+ {
1147
+ Locator_t temp_locator;
1148
+ if (network.transform_remote_locator (locator, temp_locator, m_networkConfiguration, from_this_host))
1149
+ {
1150
+ ProxyDataFilters::filter_locators (network, remote_locators_, temp_locator, false );
1151
+ }
1152
+ }
1153
+ }
1154
+ else
1155
+ {
1156
+ // Get the remote locators from the participant_data
1157
+ set_remote_locators (participant_data.default_locators , network, true , from_this_host);
1158
+ }
1159
+ }
1160
+
1152
1161
void ReaderProxyData::clear ()
1153
1162
{
1154
1163
m_expectsInlineQos = false ;
@@ -1284,12 +1293,13 @@ void ReaderProxyData::set_announced_unicast_locators(
1284
1293
1285
1294
void ReaderProxyData::set_remote_unicast_locators (
1286
1295
const LocatorList_t& locators,
1287
- const NetworkFactory& network)
1296
+ const NetworkFactory& network,
1297
+ bool from_this_host)
1288
1298
{
1289
1299
remote_locators_.unicast .clear ();
1290
1300
for (const Locator_t& locator : locators)
1291
1301
{
1292
- if (network.is_locator_remote_or_allowed (locator, m_guid. is_from_this_host () ))
1302
+ if (network.is_locator_remote_or_allowed (locator, from_this_host ))
1293
1303
{
1294
1304
remote_locators_.add_unicast_locator (locator);
1295
1305
}
@@ -1304,12 +1314,13 @@ void ReaderProxyData::add_multicast_locator(
1304
1314
1305
1315
void ReaderProxyData::set_multicast_locators (
1306
1316
const LocatorList_t& locators,
1307
- const NetworkFactory& network)
1317
+ const NetworkFactory& network,
1318
+ bool from_this_host)
1308
1319
{
1309
1320
remote_locators_.multicast .clear ();
1310
1321
for (const Locator_t& locator : locators)
1311
1322
{
1312
- if (network.is_locator_remote_or_allowed (locator, m_guid. is_from_this_host () ))
1323
+ if (network.is_locator_remote_or_allowed (locator, from_this_host ))
1313
1324
{
1314
1325
remote_locators_.add_multicast_locator (locator);
1315
1326
}
@@ -1325,14 +1336,15 @@ void ReaderProxyData::set_locators(
1325
1336
void ReaderProxyData::set_remote_locators (
1326
1337
const RemoteLocatorList& locators,
1327
1338
const NetworkFactory& network,
1328
- bool use_multicast_locators)
1339
+ bool use_multicast_locators,
1340
+ bool from_this_host)
1329
1341
{
1330
1342
remote_locators_.unicast .clear ();
1331
1343
remote_locators_.multicast .clear ();
1332
1344
1333
1345
for (const Locator_t& locator : locators.unicast )
1334
1346
{
1335
- if (network.is_locator_remote_or_allowed (locator, m_guid. is_from_this_host () ))
1347
+ if (network.is_locator_remote_or_allowed (locator, from_this_host ))
1336
1348
{
1337
1349
remote_locators_.add_unicast_locator (locator);
1338
1350
}
@@ -1342,7 +1354,7 @@ void ReaderProxyData::set_remote_locators(
1342
1354
{
1343
1355
for (const Locator_t& locator : locators.multicast )
1344
1356
{
1345
- if (network.is_locator_remote_or_allowed (locator, m_guid. is_from_this_host () ))
1357
+ if (network.is_locator_remote_or_allowed (locator, from_this_host ))
1346
1358
{
1347
1359
remote_locators_.add_multicast_locator (locator);
1348
1360
}
0 commit comments