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>
28
29
#include < utils/SystemInfo.hpp>
29
30
@@ -192,13 +193,6 @@ uint32_t ReaderProxyData::get_serialized_size(
192
193
// PID_NETWORK_CONFIGURATION_SET
193
194
ret_val += 4 + PARAMETER_NETWORKCONFIGSET_LENGTH;
194
195
195
- if (m_host_id.size () > 0 )
196
- {
197
- // PID_HOST_ID
198
- ret_val +=
199
- fastdds::dds::ParameterSerializer<Parameter_t>::cdr_serialized_size (m_host_id);
200
- }
201
-
202
196
// PID_UNICAST_LOCATOR
203
197
ret_val += static_cast <uint32_t >((4 + PARAMETER_LOCATOR_LENGTH) * remote_locators_.unicast .size ());
204
198
@@ -389,15 +383,6 @@ bool ReaderProxyData::writeToCDRMessage(
389
383
}
390
384
}
391
385
392
- if (m_host_id.size () > 0 )
393
- {
394
- ParameterString_t p (fastdds::dds::PID_HOST_ID, 0 , m_host_id);
395
- if (!fastdds::dds::ParameterSerializer<ParameterString_t>::add_to_cdr_message (p, msg))
396
- {
397
- return false ;
398
- }
399
- }
400
-
401
386
for (const Locator_t& locator : remote_locators_.unicast )
402
387
{
403
388
ParameterLocator_t p (fastdds::dds::PID_UNICAST_LOCATOR, PARAMETER_LOCATOR_LENGTH, locator);
@@ -897,33 +882,6 @@ bool ReaderProxyData::readFromCDRMessage(
897
882
m_networkConfiguration = p.netconfigSet ;
898
883
break ;
899
884
}
900
- case fastdds::dds::PID_HOST_ID:
901
- {
902
- VendorId_t local_vendor_id = source_vendor_id;
903
- if (c_VendorId_Unknown == local_vendor_id)
904
- {
905
- local_vendor_id = ((c_VendorId_Unknown == vendor_id) ? c_VendorId_eProsima : vendor_id);
906
- }
907
-
908
- // Ignore custom PID when coming from other vendors
909
- if (c_VendorId_eProsima != local_vendor_id)
910
- {
911
- EPROSIMA_LOG_INFO (RTPS_PROXY_DATA,
912
- " Ignoring custom PID" << pid << " from vendor " << local_vendor_id);
913
- return true ;
914
- }
915
-
916
- ParameterString_t p (pid, plength);
917
- if (!fastdds::dds::ParameterSerializer<ParameterString_t>::read_from_cdr_message (
918
- p, msg,
919
- plength))
920
- {
921
- return false ;
922
- }
923
-
924
- m_host_id = p.getName ();
925
- break ;
926
- }
927
885
case fastdds::dds::PID_UNICAST_LOCATOR:
928
886
{
929
887
ParameterLocator_t p (pid, plength);
@@ -933,23 +891,7 @@ bool ReaderProxyData::readFromCDRMessage(
933
891
return false ;
934
892
}
935
893
936
- if (!should_filter_locators)
937
- {
938
- remote_locators_.add_unicast_locator (p.locator );
939
- }
940
- else
941
- {
942
- Locator_t temp_locator;
943
- if (network.transform_remote_locator (p.locator , temp_locator, m_networkConfiguration,
944
- check_same_host ()))
945
- {
946
- ProxyDataFilters::filter_locators (
947
- network,
948
- remote_locators_,
949
- temp_locator,
950
- true );
951
- }
952
- }
894
+ remote_locators_.add_unicast_locator (p.locator );
953
895
break ;
954
896
}
955
897
case fastdds::dds::PID_MULTICAST_LOCATOR:
@@ -961,23 +903,7 @@ bool ReaderProxyData::readFromCDRMessage(
961
903
return false ;
962
904
}
963
905
964
- if (!should_filter_locators)
965
- {
966
- remote_locators_.add_multicast_locator (p.locator );
967
- }
968
- else
969
- {
970
- Locator_t temp_locator;
971
- if (network.transform_remote_locator (p.locator , temp_locator, m_networkConfiguration,
972
- check_same_host ()))
973
- {
974
- ProxyDataFilters::filter_locators (
975
- network,
976
- remote_locators_,
977
- temp_locator,
978
- false );
979
- }
980
- }
906
+ remote_locators_.add_unicast_locator (p.locator );
981
907
break ;
982
908
}
983
909
case fastdds::dds::PID_EXPECTS_INLINE_QOS:
@@ -1193,6 +1119,52 @@ bool ReaderProxyData::readFromCDRMessage(
1193
1119
return false ;
1194
1120
}
1195
1121
1122
+ void ReaderProxyData::setup_locators (
1123
+ const ReaderProxyData* rdata,
1124
+ NetworkFactory& network,
1125
+ const ParticipantProxyData& participant_data)
1126
+ {
1127
+ if (this == rdata)
1128
+ {
1129
+ return ;
1130
+ }
1131
+
1132
+ machine_id = participant_data.machine_id ;
1133
+
1134
+ if (has_locators ())
1135
+ {
1136
+ // Get the transformed remote locators for the ReaderProxyData received
1137
+ remote_locators_.unicast .clear ();
1138
+ remote_locators_.multicast .clear ();
1139
+ for (const Locator_t& locator : rdata->remote_locators_ .unicast )
1140
+ {
1141
+ Locator_t temp_locator;
1142
+ if (network.transform_remote_locator (locator, temp_locator, m_networkConfiguration,
1143
+ is_from_this_host ()))
1144
+ {
1145
+ ProxyDataFilters::filter_locators (network, remote_locators_, temp_locator, true );
1146
+ }
1147
+ }
1148
+ for (const Locator_t& locator : rdata->remote_locators_ .multicast )
1149
+ {
1150
+ Locator_t temp_locator;
1151
+ if (network.transform_remote_locator (locator, temp_locator, m_networkConfiguration,
1152
+ is_from_this_host ()))
1153
+ {
1154
+ ProxyDataFilters::filter_locators (network, remote_locators_, temp_locator, true );
1155
+ }
1156
+ }
1157
+ auto locators = remote_locators_;
1158
+ set_remote_locators (locators, network, true );
1159
+ }
1160
+ else
1161
+ {
1162
+ // Get the remote locators from the participant_data
1163
+ set_remote_locators (participant_data.default_locators , network, true );
1164
+ }
1165
+
1166
+ }
1167
+
1196
1168
bool ReaderProxyData::is_from_this_host ()
1197
1169
{
1198
1170
bool same_host = false ;
0 commit comments