@@ -324,14 +324,18 @@ 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- 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+ }
335339 }
336340 }
337341 return ret;
@@ -1031,14 +1035,18 @@ bool TCPTransportInterface::CreateInitialConnect(
10311035
10321036 std::vector<fastrtps::rtps::IPFinder::info_IP> local_interfaces;
10331037 // 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 )
10361040 {
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 () )
10391043 {
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+ }
10421050 }
10431051 }
10441052
@@ -1345,7 +1353,8 @@ bool TCPTransportInterface::Receive(
13451353 do
13461354 {
13471355 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 ());
13491358
13501359 if (ec)
13511360 {
0 commit comments