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 #3440

Merged
merged 15 commits into from
Apr 17, 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 @@ -460,30 +460,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 @@ -283,18 +283,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 Down Expand Up @@ -323,6 +320,14 @@ class NetworkFactory
*/
std::vector<fastdds::rtps::TransportNetmaskFilterInfo> netmask_filter_info() 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 @@ -339,14 +344,6 @@ class NetworkFactory

// Mask using transport kinds to indicate whether the transports allows localhost
NetworkConfigSet_t network_configuration_;

/**
* 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