Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18002] Internal refactor on port handling (backport #3440) #4698

Merged
merged 2 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/cpp/rtps/network/NetworkFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,30 +371,27 @@ bool NetworkFactory::configureInitialPeerLocator(
}

bool NetworkFactory::getDefaultUnicastLocators(
uint32_t domain_id,
LocatorList_t& locators,
const RTPSParticipantAttributes& m_att) const
uint32_t port) const
{
bool result = false;
for (auto& transport : mRegisteredTransports)
{
result |= transport->getDefaultUnicastLocators(locators, calculate_well_known_port(domain_id, m_att, false));
result |= transport->getDefaultUnicastLocators(locators, port);
}
return result;
}

bool NetworkFactory::fill_default_locator_port(
uint32_t domain_id,
Locator_t& locator,
const RTPSParticipantAttributes& m_att,
bool is_multicast) const
uint32_t port) const
{
bool result = false;
for (auto& transport : mRegisteredTransports)
{
if (transport->IsLocatorSupported(locator))
{
result |= transport->fillUnicastLocator(locator, calculate_well_known_port(domain_id, m_att, is_multicast));
result |= transport->fillUnicastLocator(locator, port);
}
}
return result;
Expand Down
23 changes: 10 additions & 13 deletions src/cpp/rtps/network/NetworkFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,18 +195,15 @@ class NetworkFactory
* Add locators to the default unicast configuration.
* */
bool getDefaultUnicastLocators(
uint32_t domain_id,
LocatorList_t& locators,
const RTPSParticipantAttributes& m_att) const;
uint32_t port) const;

/**
* Fill the locator with the default unicast configuration.
* */
bool fill_default_locator_port(
uint32_t domain_id,
Locator_t& locator,
const RTPSParticipantAttributes& m_att,
bool is_multicast) const;
uint32_t port) const;

/**
* Shutdown method to close the connections of the transports.
Expand All @@ -230,6 +227,14 @@ class NetworkFactory
const LocatorList_t& remote_participant_locators,
const LocatorList_t& participant_initial_peers) const;

/**
* Calculate well-known ports.
*/
uint16_t calculate_well_known_port(
uint32_t domain_id,
const RTPSParticipantAttributes& att,
bool is_multicast) const;

private:

std::vector<std::unique_ptr<fastdds::rtps::TransportInterface>> mRegisteredTransports;
Expand All @@ -243,14 +248,6 @@ class NetworkFactory

// Whether multicast metatraffic on SHM transport should always be used
bool enforce_shm_multicast_metatraffic_ = false;

/**
* Calculate well-known ports.
*/
uint16_t calculate_well_known_port(
uint32_t domain_id,
const RTPSParticipantAttributes& att,
bool is_multicast) const;
};

} // namespace rtps
Expand Down
Loading
Loading