@@ -324,14 +324,28 @@ ResponseCode TCPTransportInterface::bind_socket(
324324
325325 std::vector<fastrtps::rtps::IPFinder::info_IP> local_interfaces;
326326 // 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 )
329329 {
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 () )
332332 {
333+ <<<<<<< HEAD
333334 IPLocator::setIPv4 (local_locator, interface_it.locator );
334335 channel_resources_.insert (decltype (channel_resources_)::value_type{local_locator, channel});
336+ =======
337+ Locator local_locator (channel->locator ());
338+ for (auto & interface_it : local_interfaces)
339+ {
340+ IPLocator::copy_address (interface_it.locator , local_locator);
341+ const auto insert_ret_local = channel_resources_.insert (
342+ decltype (channel_resources_)::value_type{local_locator, channel});
343+ if (!insert_ret_local.first ->second ->connection_established ())
344+ {
345+ insert_ret_local.first ->second = channel;
346+ }
347+ }
348+ >>>>>>> f2a55e9a (Avoid calling setIPv4 in TCPTransportInterface (#5492 ))
335349 }
336350 }
337351 return ret;
@@ -1031,14 +1045,18 @@ bool TCPTransportInterface::CreateInitialConnect(
10311045
10321046 std::vector<fastrtps::rtps::IPFinder::info_IP> local_interfaces;
10331047 // 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 () )
1048+ // Note: Only applicable for TCPv4 until TCPv6 scope selection is implemented
1049+ if (physical_locator. kind != LOCATOR_KIND_TCPv6 )
10361050 {
1037- Locator local_locator (physical_locator);
1038- for ( auto & interface_it : local_interfaces)
1051+ is_own_interface (physical_locator, local_interfaces );
1052+ if (! local_interfaces. empty () )
10391053 {
1040- IPLocator::setIPv4 (local_locator, interface_it.locator );
1041- channel_resources_[local_locator] = channel;
1054+ Locator local_locator (physical_locator);
1055+ for (auto & interface_it : local_interfaces)
1056+ {
1057+ IPLocator::copy_address (interface_it.locator , local_locator);
1058+ channel_resources_[local_locator] = channel;
1059+ }
10421060 }
10431061 }
10441062
@@ -1345,7 +1363,8 @@ bool TCPTransportInterface::Receive(
13451363 do
13461364 {
13471365 header_found = receive_header (channel, tcp_header, ec);
1348- } while (!header_found && !ec && channel->connection_status ());
1366+ }
1367+ while (!header_found && !ec && channel->connection_status ());
13491368
13501369 if (ec)
13511370 {
0 commit comments