@@ -324,14 +324,18 @@ ResponseCode TCPTransportInterface::bind_socket(
324
324
325
325
std::vector<fastrtps::rtps::IPFinder::info_IP> local_interfaces;
326
326
// Check if the locator is from an owned interface to link all local interfaces to the channel
327
- is_own_interface (channel-> locator (), local_interfaces);
328
- if (!local_interfaces. empty () )
327
+ // Note: Only applicable for TCPv4 until TCPv6 scope selection is implemented
328
+ if (channel-> locator (). kind != LOCATOR_KIND_TCPv6 )
329
329
{
330
- Locator local_locator (channel->locator ());
331
- for ( auto & interface_it : local_interfaces)
330
+ is_own_interface (channel->locator (), local_interfaces );
331
+ if (! local_interfaces. empty () )
332
332
{
333
- IPLocator::setIPv4 (local_locator, interface_it.locator );
334
- channel_resources_.insert (decltype (channel_resources_)::value_type{local_locator, channel});
333
+ Locator local_locator (channel->locator ());
334
+ for (auto & interface_it : local_interfaces)
335
+ {
336
+ IPLocator::copy_address (interface_it.locator , local_locator);
337
+ channel_resources_.insert (decltype (channel_resources_)::value_type{local_locator, channel});
338
+ }
335
339
}
336
340
}
337
341
return ret;
@@ -1031,14 +1035,18 @@ bool TCPTransportInterface::CreateInitialConnect(
1031
1035
1032
1036
std::vector<fastrtps::rtps::IPFinder::info_IP> local_interfaces;
1033
1037
// Check if the locator is from an owned interface to link all local interfaces to the channel
1034
- is_own_interface (physical_locator, local_interfaces);
1035
- if (!local_interfaces. empty () )
1038
+ // Note: Only applicable for TCPv4 until TCPv6 scope selection is implemented
1039
+ if (physical_locator. kind != LOCATOR_KIND_TCPv6 )
1036
1040
{
1037
- Locator local_locator (physical_locator);
1038
- for ( auto & interface_it : local_interfaces)
1041
+ is_own_interface (physical_locator, local_interfaces );
1042
+ if (! local_interfaces. empty () )
1039
1043
{
1040
- IPLocator::setIPv4 (local_locator, interface_it.locator );
1041
- channel_resources_[local_locator] = channel;
1044
+ Locator local_locator (physical_locator);
1045
+ for (auto & interface_it : local_interfaces)
1046
+ {
1047
+ IPLocator::copy_address (interface_it.locator , local_locator);
1048
+ channel_resources_[local_locator] = channel;
1049
+ }
1042
1050
}
1043
1051
}
1044
1052
@@ -1345,7 +1353,8 @@ bool TCPTransportInterface::Receive(
1345
1353
do
1346
1354
{
1347
1355
header_found = receive_header (channel, tcp_header, ec);
1348
- } while (!header_found && !ec && channel->connection_status ());
1356
+ }
1357
+ while (!header_found && !ec && channel->connection_status ());
1349
1358
1350
1359
if (ec)
1351
1360
{
0 commit comments