Skip to content

Commit

Permalink
Refs #22056: Only disable builtin_transports when UDP server is not i…
Browse files Browse the repository at this point in the history
…nitialized

Signed-off-by: cferreiragonz <[email protected]>
  • Loading branch information
cferreiragonz committed Nov 6, 2024
1 parent cddc507 commit f563542
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tools/fds/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ int fastdds_discovery_server(
// Retrieve first TCP port
option::Option* pO_tcp_port = options[TCP_PORT];

bool udp_server_initialized = true ? (pOp != nullptr || pO_port != nullptr) : false;

/**
* A locator has been initialized previously in [0.0.0.0] address using either the DEFAULT_ROS2_SERVER_PORT or the
* port number set in the CLI. This locator must be used:
Expand All @@ -318,6 +320,7 @@ int fastdds_discovery_server(
// Add default locator in cases a) and b)
participantQos.wire_protocol().builtin.metatrafficUnicastLocatorList.clear();
participantQos.wire_protocol().builtin.metatrafficUnicastLocatorList.push_back(locator4);
udp_server_initialized = true;
}
else if (nullptr == pOp && nullptr != pO_port)
{
Expand Down Expand Up @@ -569,7 +572,7 @@ int fastdds_discovery_server(
}

fastdds::rtps::GuidPrefix_t guid_prefix = participantQos.wire_protocol().prefix;
participantQos.transport().use_builtin_transports = false;
participantQos.transport().use_builtin_transports = true ? udp_server_initialized : false;

// Create the server
int return_value = 0;
Expand Down

0 comments on commit f563542

Please sign in to comment.