Skip to content

Commit a429ccf

Browse files
Internal refactor on port handling (#3440) (#4698)
* Internal refactor on port handling (#3440) * Refs #18002. Avoid mutation of multicast ports. Signed-off-by: Miguel Company <[email protected]> * Refs #18002. Move security initalization up. Signed-off-by: Miguel Company <[email protected]> * Refs #18002. Prepare for refactor of locators setup. Signed-off-by: Miguel Company <[email protected]> * Refs #18002. Refactor metatraffic related code. Signed-off-by: Miguel Company <[email protected]> * Refs #18002. Refactor initial peers related code. Signed-off-by: Miguel Company <[email protected]> * Refs #18002. Refactor user traffic related code. Signed-off-by: Miguel Company <[email protected]> * Refs #18002. Refactor output traffic related code. Signed-off-by: Miguel Company <[email protected]> * Refs #18002. Safe metatraffic unicast port on a new attribute. Signed-off-by: Miguel Company <[email protected]> * Refs #18002. User unicast port calculated on participant instead of NetworkFactory. Signed-off-by: Miguel Company <[email protected]> * Refs #18002. Update metatraffic_unicast_port_ inside applyLocatorAdaptRule. Signed-off-by: Miguel Company <[email protected]> * Apply suggestion Signed-off-by: Miguel Company <[email protected]> * Refs #18002. Always create unicast receiver resources first. Signed-off-by: Miguel Company <[email protected]> * Refs #18002. Improve warning message. Signed-off-by: Miguel Company <[email protected]> * Refs #18002. Refactor createReceiverResources Signed-off-by: Miguel Company <[email protected]> * Refs #18002. Improve SHM.SamePortUnicastMulticast blackbox test Signed-off-by: Miguel Company <[email protected]> --------- Signed-off-by: Miguel Company <[email protected]> Signed-off-by: Miguel Company <[email protected]> (cherry picked from commit ea5af48) # Conflicts: # src/cpp/rtps/network/NetworkFactory.h # src/cpp/rtps/participant/RTPSParticipantImpl.cpp * Fix conflicts. Signed-off-by: Miguel Company <[email protected]> --------- Signed-off-by: Miguel Company <[email protected]> Co-authored-by: Miguel Company <[email protected]>
1 parent d24584c commit a429ccf

File tree

5 files changed

+173
-124
lines changed

5 files changed

+173
-124
lines changed

src/cpp/rtps/network/NetworkFactory.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -371,30 +371,27 @@ bool NetworkFactory::configureInitialPeerLocator(
371371
}
372372

373373
bool NetworkFactory::getDefaultUnicastLocators(
374-
uint32_t domain_id,
375374
LocatorList_t& locators,
376-
const RTPSParticipantAttributes& m_att) const
375+
uint32_t port) const
377376
{
378377
bool result = false;
379378
for (auto& transport : mRegisteredTransports)
380379
{
381-
result |= transport->getDefaultUnicastLocators(locators, calculate_well_known_port(domain_id, m_att, false));
380+
result |= transport->getDefaultUnicastLocators(locators, port);
382381
}
383382
return result;
384383
}
385384

386385
bool NetworkFactory::fill_default_locator_port(
387-
uint32_t domain_id,
388386
Locator_t& locator,
389-
const RTPSParticipantAttributes& m_att,
390-
bool is_multicast) const
387+
uint32_t port) const
391388
{
392389
bool result = false;
393390
for (auto& transport : mRegisteredTransports)
394391
{
395392
if (transport->IsLocatorSupported(locator))
396393
{
397-
result |= transport->fillUnicastLocator(locator, calculate_well_known_port(domain_id, m_att, is_multicast));
394+
result |= transport->fillUnicastLocator(locator, port);
398395
}
399396
}
400397
return result;

src/cpp/rtps/network/NetworkFactory.h

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -195,18 +195,15 @@ class NetworkFactory
195195
* Add locators to the default unicast configuration.
196196
* */
197197
bool getDefaultUnicastLocators(
198-
uint32_t domain_id,
199198
LocatorList_t& locators,
200-
const RTPSParticipantAttributes& m_att) const;
199+
uint32_t port) const;
201200

202201
/**
203202
* Fill the locator with the default unicast configuration.
204203
* */
205204
bool fill_default_locator_port(
206-
uint32_t domain_id,
207205
Locator_t& locator,
208-
const RTPSParticipantAttributes& m_att,
209-
bool is_multicast) const;
206+
uint32_t port) const;
210207

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

230+
/**
231+
* Calculate well-known ports.
232+
*/
233+
uint16_t calculate_well_known_port(
234+
uint32_t domain_id,
235+
const RTPSParticipantAttributes& att,
236+
bool is_multicast) const;
237+
233238
private:
234239

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

244249
// Whether multicast metatraffic on SHM transport should always be used
245250
bool enforce_shm_multicast_metatraffic_ = false;
246-
247-
/**
248-
* Calculate well-known ports.
249-
*/
250-
uint16_t calculate_well_known_port(
251-
uint32_t domain_id,
252-
const RTPSParticipantAttributes& att,
253-
bool is_multicast) const;
254251
};
255252

256253
} // namespace rtps

0 commit comments

Comments
 (0)