@@ -319,18 +319,22 @@ ResponseCode TCPTransportInterface::bind_socket(
319
319
320
320
std::vector<fastdds::rtps::IPFinder::info_IP> local_interfaces;
321
321
// Check if the locator is from an owned interface to link all local interfaces to the channel
322
- is_own_interface (channel-> locator (), local_interfaces);
323
- if (!local_interfaces. empty () )
322
+ // Note: Only applicable for TCPv4 until TCPv6 scope selection is implemented
323
+ if (channel-> locator (). kind != LOCATOR_KIND_TCPv6 )
324
324
{
325
- Locator local_locator (channel->locator ());
326
- for ( auto & interface_it : local_interfaces)
325
+ is_own_interface (channel->locator (), local_interfaces );
326
+ if (! local_interfaces. empty () )
327
327
{
328
- IPLocator::setIPv4 (local_locator, interface_it.locator );
329
- const auto insert_ret_local = channel_resources_.insert (
330
- decltype (channel_resources_)::value_type{local_locator, channel});
331
- if (!insert_ret_local.first ->second ->connection_established ())
328
+ Locator local_locator (channel->locator ());
329
+ for (auto & interface_it : local_interfaces)
332
330
{
333
- insert_ret_local.first ->second = channel;
331
+ IPLocator::copy_address (interface_it.locator , local_locator);
332
+ const auto insert_ret_local = channel_resources_.insert (
333
+ decltype (channel_resources_)::value_type{local_locator, channel});
334
+ if (!insert_ret_local.first ->second ->connection_established ())
335
+ {
336
+ insert_ret_local.first ->second = channel;
337
+ }
334
338
}
335
339
}
336
340
}
@@ -1035,14 +1039,18 @@ bool TCPTransportInterface::CreateInitialConnect(
1035
1039
1036
1040
std::vector<fastdds::rtps::IPFinder::info_IP> local_interfaces;
1037
1041
// Check if the locator is from an owned interface to link all local interfaces to the channel
1038
- is_own_interface (physical_locator, local_interfaces);
1039
- if (!local_interfaces. empty () )
1042
+ // Note: Only applicable for TCPv4 until TCPv6 scope selection is implemented
1043
+ if (physical_locator. kind != LOCATOR_KIND_TCPv6 )
1040
1044
{
1041
- Locator local_locator (physical_locator);
1042
- for ( auto & interface_it : local_interfaces)
1045
+ is_own_interface (physical_locator, local_interfaces );
1046
+ if (! local_interfaces. empty () )
1043
1047
{
1044
- IPLocator::setIPv4 (local_locator, interface_it.locator );
1045
- channel_resources_[local_locator] = channel;
1048
+ Locator local_locator (physical_locator);
1049
+ for (auto & interface_it : local_interfaces)
1050
+ {
1051
+ IPLocator::copy_address (interface_it.locator , local_locator);
1052
+ channel_resources_[local_locator] = channel;
1053
+ }
1046
1054
}
1047
1055
}
1048
1056
@@ -1349,7 +1357,8 @@ bool TCPTransportInterface::Receive(
1349
1357
do
1350
1358
{
1351
1359
header_found = receive_header (channel, tcp_header, ec);
1352
- } while (!header_found && !ec && channel->connection_status ());
1360
+ }
1361
+ while (!header_found && !ec && channel->connection_status ());
1353
1362
1354
1363
if (ec)
1355
1364
{
0 commit comments