Skip to content

Commit

Permalink
Refs #21170: Create OpenOutputChannels for initial_peers
Browse files Browse the repository at this point in the history
Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>
  • Loading branch information
cferreiragonz committed Jun 13, 2024
1 parent a12e8e7 commit 4744a3b
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,12 @@ bool PDPSimple::create_dcps_participant_endpoints()

WriterAttributes watt = create_builtin_writer_attributes();
watt.endpoint.reliabilityKind = BEST_EFFORT;
watt.endpoint.remoteLocatorList = m_discovery.initialPeersList;
if (!m_discovery.initialPeersList.empty())
{
auto entry = LocatorSelectorEntry::create_fully_selected_entry(
m_discovery.initialPeersList, LocatorList_t());
mp_RTPSParticipant->createSenderResources(entry);
}

// We assume that if we have at least one flow controller defined, we use async flow controller
if (!pattr.flow_controllers.empty())
Expand Down
13 changes: 13 additions & 0 deletions src/cpp/rtps/transport/UDPTransportInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,19 @@ bool UDPTransportInterface::OpenOutputChannel(
return true;
}

bool UDPTransportInterface::OpenOutputChannels(
SendResourceList& send_resource_list,
const LocatorSelectorEntry& locator_selector_entry)
{
bool success = false;
for (size_t i = 0; i < locator_selector_entry.state.unicast.size(); ++i)
{
size_t index = locator_selector_entry.state.unicast[i];
success |= OpenOutputChannel(send_resource_list, locator_selector_entry.unicast[index]);
}
return success;
}

Locator UDPTransportInterface::RemoteToMainLocal(
const Locator& remote) const
{
Expand Down
12 changes: 12 additions & 0 deletions src/cpp/rtps/transport/UDPTransportInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@ class UDPTransportInterface : public TransportInterface
SendResourceList& sender_resource_list,
const Locator&) override;

/**
* Opens a socket on the locators provided by the given locator_selector_entry.
*
* @param sender_resource_list Participant's send resource list.
* @param locator_selector_entry Locator selector entry with the remote entity locators.
*
* @return true if the socket was correctly opened or if finding an already opened one.
*/
bool OpenOutputChannels(
SendResourceList& sender_resource_list,
const fastrtps::rtps::LocatorSelectorEntry& locator_selector_entry) override;

/**
* Converts a given remote locator (that is, a locator referring to a remote
* destination) to the main local locator whose channel can write to that
Expand Down
13 changes: 13 additions & 0 deletions src/cpp/rtps/transport/shared_mem/SharedMemTransport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,19 @@ bool SharedMemTransport::OpenOutputChannel(
return true;
}

bool SharedMemTransport::OpenOutputChannels(
SendResourceList& send_resource_list,
const LocatorSelectorEntry& locator_selector_entry)
{
bool success = false;
for (size_t i = 0; i < locator_selector_entry.state.unicast.size(); ++i)
{
size_t index = locator_selector_entry.state.unicast[i];
success |= OpenOutputChannel(send_resource_list, locator_selector_entry.unicast[index]);
}
return success;
}

Locator SharedMemTransport::RemoteToMainLocal(
const Locator& remote) const
{
Expand Down
12 changes: 12 additions & 0 deletions src/cpp/rtps/transport/shared_mem/SharedMemTransport.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@ class SharedMemTransport : public TransportInterface
SendResourceList& sender_resource_list,
const Locator&) override;

/**
* Opens a socket on the locators provided by the given locator_selector_entry.
*
* @param sender_resource_list Participant's send resource list.
* @param locator_selector_entry Locator selector entry with the remote entity locators.
*
* @return true if the socket was correctly opened or if finding an already opened one.
*/
bool OpenOutputChannels(
SendResourceList& sender_resource_list,
const fastrtps::rtps::LocatorSelectorEntry& locator_selector_entry) override;

/**
* Converts a given remote locator (that is, a locator referring to a remote
* destination) to the main local locator whose channel can write to that
Expand Down

0 comments on commit 4744a3b

Please sign in to comment.