From 34f8e81ac4f22576d6d72fc8cc338288c2bdd71c Mon Sep 17 00:00:00 2001 From: Miguel Company Date: Fri, 26 Mar 2021 09:21:06 +0100 Subject: [PATCH 1/7] Refs 11001. Improve blackbox test by waiting for ACKs. Signed-off-by: Miguel Company --- test/blackbox/BlackboxTestsPubSubBasic.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/blackbox/BlackboxTestsPubSubBasic.cpp b/test/blackbox/BlackboxTestsPubSubBasic.cpp index 0ba132f15cf..bd0a0a11ee1 100644 --- a/test/blackbox/BlackboxTestsPubSubBasic.cpp +++ b/test/blackbox/BlackboxTestsPubSubBasic.cpp @@ -253,6 +253,7 @@ TEST_P(PubSubBasic, PubSubMoreThan256Unacknowledged) reader.startReception(expected_data); reader.block_for_all(); + EXPECT_TRUE(writer.waitForAllAcked(std::chrono::seconds(10))); } TEST_P(PubSubBasic, PubSubAsReliableHelloworldMulticastDisabled) @@ -286,6 +287,7 @@ TEST_P(PubSubBasic, PubSubAsReliableHelloworldMulticastDisabled) ASSERT_TRUE(data.empty()); // Block reader until reception finished or timeout. reader.block_for_all(); + EXPECT_TRUE(writer.waitForAllAcked(std::chrono::seconds(10))); } TEST_P(PubSubBasic, ReceivedDynamicDataWithNoSizeLimit) From f2895962f8ad3186ba3c9e410c645480a2a86419 Mon Sep 17 00:00:00 2001 From: Miguel Company Date: Thu, 25 Mar 2021 16:23:52 +0100 Subject: [PATCH 2/7] Refs 11001. Fix SharedMemTransportDescriptor::min_send_buffer_size() Signed-off-by: Miguel Company --- .../rtps/transport/shared_mem/SharedMemTransportDescriptor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fastdds/rtps/transport/shared_mem/SharedMemTransportDescriptor.h b/include/fastdds/rtps/transport/shared_mem/SharedMemTransportDescriptor.h index a6e939443ba..deecf7d9176 100644 --- a/include/fastdds/rtps/transport/shared_mem/SharedMemTransportDescriptor.h +++ b/include/fastdds/rtps/transport/shared_mem/SharedMemTransportDescriptor.h @@ -38,7 +38,7 @@ typedef struct SharedMemTransportDescriptor : public TransportDescriptorInterfac virtual TransportInterface* create_transport() const override; uint32_t min_send_buffer_size() const override { - return 0; + return segment_size_; } RTPS_DllAPI SharedMemTransportDescriptor(); From d2c23dd0244fa7c0d4556099b56fc4910ebea114 Mon Sep 17 00:00:00 2001 From: Miguel Company Date: Fri, 26 Mar 2021 09:21:56 +0100 Subject: [PATCH 3/7] Refs 11001. Removed unused local variable. Signed-off-by: Miguel Company --- src/cpp/rtps/participant/RTPSParticipantImpl.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp index 362281c41d3..dee4afb3b57 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp @@ -952,7 +952,6 @@ bool RTPSParticipantImpl::assignEndpoint2LocatorList( one of the supported Locators is needed to make the match, and the case of new ListenResources being created has been removed since its the NetworkFactory the one that takes care of Resource creation. */ - LocatorList_t finalList; for (auto lit = list.begin(); lit != list.end(); ++lit) { //Iteration of all Locators within the Locator list passed down as argument From 6e518611239cc34607fda740615fec8dc01c7fef Mon Sep 17 00:00:00 2001 From: Miguel Company Date: Fri, 26 Mar 2021 09:22:54 +0100 Subject: [PATCH 4/7] Refs 11001. Sender resources created after starting WriterProxy. Signed-off-by: Miguel Company --- src/cpp/rtps/reader/StatefulReader.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cpp/rtps/reader/StatefulReader.cpp b/src/cpp/rtps/reader/StatefulReader.cpp index 2637de1ba53..e93588d7533 100644 --- a/src/cpp/rtps/reader/StatefulReader.cpp +++ b/src/cpp/rtps/reader/StatefulReader.cpp @@ -141,6 +141,12 @@ bool StatefulReader::matched_writer_add( matched_writers_pool_.pop_back(); } + SequenceNumber_t initial_sequence; + add_persistence_guid(wdata.guid(), wdata.persistence_guid()); + initial_sequence = get_last_notified(wdata.guid()); + + wp->start(wdata, initial_sequence); + if (!is_same_process) { for (const Locator_t& locator : wp->remote_locators_shrinked()) @@ -149,12 +155,6 @@ bool StatefulReader::matched_writer_add( } } - SequenceNumber_t initial_sequence; - add_persistence_guid(wdata.guid(), wdata.persistence_guid()); - initial_sequence = get_last_notified(wdata.guid()); - - wp->start(wdata, initial_sequence); - matched_writers_.push_back(wp); if (liveliness_lease_duration_ < c_TimeInfinite) From 07b867bd4001d274a386ebacf8bd25a5c3ef72c9 Mon Sep 17 00:00:00 2001 From: Miguel Company Date: Fri, 26 Mar 2021 09:31:00 +0100 Subject: [PATCH 5/7] Refs 11001. Uncrustify ReceiverResource.cpp Signed-off-by: Miguel Company --- src/cpp/rtps/network/ReceiverResource.cpp | 58 +++++++++++++++-------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/src/cpp/rtps/network/ReceiverResource.cpp b/src/cpp/rtps/network/ReceiverResource.cpp index 108d84133e7..35449dc759d 100644 --- a/src/cpp/rtps/network/ReceiverResource.cpp +++ b/src/cpp/rtps/network/ReceiverResource.cpp @@ -17,25 +17,25 @@ #include #include -#define IDSTRING "(ID:" << std::this_thread::get_id() <<") "<< +#define IDSTRING "(ID:" << std::this_thread::get_id() << ") " << using namespace std; using namespace eprosima::fastdds::rtps; -namespace eprosima{ -namespace fastrtps{ -namespace rtps{ +namespace eprosima { +namespace fastrtps { +namespace rtps { ReceiverResource::ReceiverResource( - TransportInterface& transport, - const Locator_t& locator, - uint32_t max_recv_buffer_size) - : Cleanup(nullptr) - , LocatorMapsToManagedChannel(nullptr) - , mValid(false) - , mtx() - , receiver(nullptr) - , max_message_size_(max_recv_buffer_size) + TransportInterface& transport, + const Locator_t& locator, + uint32_t max_recv_buffer_size) + : Cleanup(nullptr) + , LocatorMapsToManagedChannel(nullptr) + , mValid(false) + , mtx() + , receiver(nullptr) + , max_message_size_(max_recv_buffer_size) { // Internal channel is opened and assigned to this resource. mValid = transport.OpenInputChannel(locator, this, max_message_size_); @@ -45,12 +45,18 @@ ReceiverResource::ReceiverResource( } // Implementation functions are bound to the right transport parameters - Cleanup = [&transport, locator]() { transport.CloseInputChannel(locator); }; + Cleanup = [&transport, locator]() + { + transport.CloseInputChannel(locator); + }; LocatorMapsToManagedChannel = [&transport, locator](const Locator_t& locatorToCheck) -> bool - { return transport.DoInputLocatorsMatch(locator, locatorToCheck); }; + { + return transport.DoInputLocatorsMatch(locator, locatorToCheck); + }; } -ReceiverResource::ReceiverResource(ReceiverResource&& rValueResource) +ReceiverResource::ReceiverResource( + ReceiverResource&& rValueResource) { Cleanup.swap(rValueResource.Cleanup); LocatorMapsToManagedChannel.swap(rValueResource.LocatorMapsToManagedChannel); @@ -61,7 +67,8 @@ ReceiverResource::ReceiverResource(ReceiverResource&& rValueResource) max_message_size_ = rValueResource.max_message_size_; } -bool ReceiverResource::SupportsLocator(const Locator_t& localLocator) +bool ReceiverResource::SupportsLocator( + const Locator_t& localLocator) { if (LocatorMapsToManagedChannel) { @@ -70,22 +77,31 @@ bool ReceiverResource::SupportsLocator(const Locator_t& localLocator) return false; } -void ReceiverResource::RegisterReceiver(MessageReceiver* rcv) +void ReceiverResource::RegisterReceiver( + MessageReceiver* rcv) { std::unique_lock lock(mtx); if (receiver == nullptr) + { receiver = rcv; + } } -void ReceiverResource::UnregisterReceiver(MessageReceiver* rcv) +void ReceiverResource::UnregisterReceiver( + MessageReceiver* rcv) { std::unique_lock lock(mtx); if (receiver == rcv) + { receiver = nullptr; + } } -void ReceiverResource::OnDataReceived(const octet * data, const uint32_t size, - const Locator_t & localLocator, const Locator_t & remoteLocator) +void ReceiverResource::OnDataReceived( + const octet* data, + const uint32_t size, + const Locator_t& localLocator, + const Locator_t& remoteLocator) { (void)localLocator; From 111494219a1d04b06c129a1d070d397245bcec05 Mon Sep 17 00:00:00 2001 From: Miguel Company Date: Fri, 26 Mar 2021 09:33:59 +0100 Subject: [PATCH 6/7] Refs 11001. Fix locator support check on ReceiverResource. Signed-off-by: Miguel Company --- src/cpp/rtps/network/ReceiverResource.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpp/rtps/network/ReceiverResource.cpp b/src/cpp/rtps/network/ReceiverResource.cpp index 35449dc759d..1762c30f340 100644 --- a/src/cpp/rtps/network/ReceiverResource.cpp +++ b/src/cpp/rtps/network/ReceiverResource.cpp @@ -51,7 +51,7 @@ ReceiverResource::ReceiverResource( }; LocatorMapsToManagedChannel = [&transport, locator](const Locator_t& locatorToCheck) -> bool { - return transport.DoInputLocatorsMatch(locator, locatorToCheck); + return locator.kind == locatorToCheck.kind && transport.DoInputLocatorsMatch(locator, locatorToCheck); }; } From 4df180eda764537a75f9b0b781cff70fa1ca9902 Mon Sep 17 00:00:00 2001 From: Miguel Company Date: Mon, 29 Mar 2021 09:58:33 +0200 Subject: [PATCH 7/7] Refs 11001. Uncrustify. Signed-off-by: Miguel Company --- .../shared_mem/SharedMemTransportDescriptor.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/fastdds/rtps/transport/shared_mem/SharedMemTransportDescriptor.h b/include/fastdds/rtps/transport/shared_mem/SharedMemTransportDescriptor.h index deecf7d9176..a7ff8b300fc 100644 --- a/include/fastdds/rtps/transport/shared_mem/SharedMemTransportDescriptor.h +++ b/include/fastdds/rtps/transport/shared_mem/SharedMemTransportDescriptor.h @@ -30,9 +30,9 @@ class TransportInterface; */ typedef struct SharedMemTransportDescriptor : public TransportDescriptorInterface { - virtual ~SharedMemTransportDescriptor() + virtual ~SharedMemTransportDescriptor() { - + } virtual TransportInterface* create_transport() const override; @@ -40,7 +40,7 @@ typedef struct SharedMemTransportDescriptor : public TransportDescriptorInterfac { return segment_size_; } - + RTPS_DllAPI SharedMemTransportDescriptor(); RTPS_DllAPI SharedMemTransportDescriptor( @@ -50,7 +50,7 @@ typedef struct SharedMemTransportDescriptor : public TransportDescriptorInterfac { return segment_size_; } - + RTPS_DllAPI void segment_size( uint32_t segment_size) { @@ -58,8 +58,8 @@ typedef struct SharedMemTransportDescriptor : public TransportDescriptorInterfac } virtual uint32_t max_message_size() const override - { - return maxMessageSize; + { + return maxMessageSize; } RTPS_DllAPI void max_message_size(