@@ -319,18 +319,22 @@ ResponseCode TCPTransportInterface::bind_socket(
319319
320320 std::vector<fastdds::rtps::IPFinder::info_IP> local_interfaces;
321321 // 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 )
324324 {
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 () )
327327 {
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)
332330 {
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+ }
334338 }
335339 }
336340 }
@@ -1035,14 +1039,18 @@ bool TCPTransportInterface::CreateInitialConnect(
10351039
10361040 std::vector<fastdds::rtps::IPFinder::info_IP> local_interfaces;
10371041 // 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 )
10401044 {
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 () )
10431047 {
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+ }
10461054 }
10471055 }
10481056
@@ -1349,7 +1357,8 @@ bool TCPTransportInterface::Receive(
13491357 do
13501358 {
13511359 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 ());
13531362
13541363 if (ec)
13551364 {
0 commit comments