Skip to content

Commit

Permalink
Refs #20238: Adding interface to locator if whitelist is not empty
Browse files Browse the repository at this point in the history
Signed-off-by: cferreiragonz <[email protected]>
  • Loading branch information
cferreiragonz committed Jan 26, 2024
1 parent ab1ec9d commit 0fba001
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 17 additions & 1 deletion src/cpp/rtps/transport/TCPTransportInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ void TCPTransportInterface::calculate_crc(
}

uint16_t TCPTransportInterface::create_acceptor_socket(
const Locator& locator)
Locator& locator)
{
uint16_t final_port = 0;
try
Expand Down Expand Up @@ -338,6 +338,14 @@ uint16_t TCPTransportInterface::create_acceptor_socket(
#if TLS_FOUND
if (configuration()->apply_security)
{
if (locator.kind == LOCATOR_KIND_TCPv4)
{
IPLocator::setIPv4(locator, sInterface);
}
else if (locator.kind == LOCATOR_KIND_TCPv6)
{
IPLocator::setIPv6(locator, sInterface);
}
std::shared_ptr<TCPAcceptorSecure> acceptor =
std::make_shared<TCPAcceptorSecure>(io_service_, sInterface, locator);
acceptors_[acceptor->locator()] = acceptor;
Expand All @@ -347,6 +355,14 @@ uint16_t TCPTransportInterface::create_acceptor_socket(
else
#endif // if TLS_FOUND
{
if (locator.kind == LOCATOR_KIND_TCPv4)
{
IPLocator::setIPv4(locator, sInterface);
}
else if (locator.kind == LOCATOR_KIND_TCPv6)
{
IPLocator::setIPv6(locator, sInterface);
}
std::shared_ptr<TCPAcceptorBasic> acceptor =
std::make_shared<TCPAcceptorBasic>(io_service_, sInterface, locator);
acceptors_[acceptor->locator()] = acceptor;
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/transport/TCPTransportInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class TCPTransportInterface : public TransportInterface

//! Creates a TCP acceptor to wait for incoming connections by the given locator.
uint16_t create_acceptor_socket(
const Locator& locator);
Locator& locator);

virtual void get_ips(
std::vector<fastrtps::rtps::IPFinder::info_IP>& loc_names,
Expand Down

0 comments on commit 0fba001

Please sign in to comment.