Skip to content

Commit

Permalink
Refs #20307: Appy Miguel's suggestions
Browse files Browse the repository at this point in the history
Signed-off-by: EduPonz <[email protected]>
  • Loading branch information
EduPonz committed Jan 30, 2024
1 parent 841dfab commit 5931f7a
Show file tree
Hide file tree
Showing 11 changed files with 273 additions and 29 deletions.
9 changes: 8 additions & 1 deletion src/cpp/fastdds/core/policy/ParameterList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ bool ParameterList::updateCacheChangeFromInlineQos(
{
// TODO(eduponz): This check is done here because an implicit fall through rises a warning.
// C++17 included a [[fallthrough]] attribute to avoid this kind of warning.
if (pid == PID_RELATED_ENTITY_GUID)
if (pid == PID_CUSTOM_RELATED_SAMPLE_IDENTITY)
{
// Ignore custom PID when coming from other vendors except RTI Connext
if ((rtps::c_VendorId_eProsima != change.vendor_id) &&
Expand All @@ -87,6 +87,13 @@ bool ParameterList::updateCacheChangeFromInlineQos(
return false;
}

/*
* TODO(eduponz): The data from this PID should be used to filled the
* related_sample_identity field, not the sample_identity one.
* Changing this here implies a behaviour change in the
* RTPS layer, so it is postponed until the next major release.
*/
FASTDDS_TODO_BEFORE(3, 0, "Fill related sample identity instead");
change.write_params.sample_identity(p.sample_id);
}
break;
Expand Down
8 changes: 8 additions & 0 deletions src/cpp/fastdds/subscriber/DataReaderImpl/ReadTakeCommand.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,17 @@ struct ReadTakeCommand
info.reception_timestamp = item->reader_info.receptionTimestamp;
info.instance_handle = item->instanceHandle;
info.publication_handle = InstanceHandle_t(item->writerGUID);

/*
* TODO(eduponz): The sample identity should be taken from the sample identity parameter.
* More importantly, the related sample identity should be taken from the related sample identity
* in write_params.
*/
FASTDDS_TODO_BEFORE(3, 0, "Fill both sample_identity and related_sample_identity with write_params");
info.sample_identity.writer_guid(item->writerGUID);
info.sample_identity.sequence_number(item->sequenceNumber);
info.related_sample_identity = item->write_params.sample_identity();

info.valid_data = true;

switch (item->kind)
Expand Down
5 changes: 3 additions & 2 deletions src/cpp/rtps/DataSharing/DataSharingListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ void DataSharingListener::process_new_data ()
{
EPROSIMA_LOG_WARNING(RTPS_READER, "GAP (" << last_sequence + 1 << " - " << ch.sequenceNumber - 1 << ")"
<< " detected on datasharing writer " << pool->writer());
reader_->processGapMsg(pool->writer(), last_sequence + 1, SequenceNumberSet_t(ch.sequenceNumber));
reader_->processGapMsg(pool->writer(), last_sequence + 1, SequenceNumberSet_t(
ch.sequenceNumber), c_VendorId_eProsima);
}

if (last_sequence == c_SequenceNumber_Unknown && ch.sequenceNumber > SequenceNumber_t(0, 1))
Expand All @@ -182,7 +183,7 @@ void DataSharingListener::process_new_data ()
<< " detected on datasharing writer " <<
pool->writer());
reader_->processGapMsg(pool->writer(), SequenceNumber_t(0, 1), SequenceNumberSet_t(
ch.sequenceNumber));
ch.sequenceNumber), c_VendorId_eProsima);
}

EPROSIMA_LOG_INFO(RTPS_READER, "New data found on writer " << pool->writer()
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/builtin/data/ParticipantProxyData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ bool ParticipantProxyData::readFromCDRMessage(
bool should_filter_locators,
fastdds::rtps::VendorId_t source_vendor_id)
{
auto param_process = [this, &network, &is_shm_transport_available, &should_filter_locators, &source_vendor_id](
auto param_process = [this, &network, &is_shm_transport_available, &should_filter_locators, source_vendor_id](
CDRMessage_t* msg, const ParameterId_t& pid, uint16_t plength)
{
switch (pid)
Expand Down
10 changes: 5 additions & 5 deletions src/cpp/rtps/builtin/data/ReaderProxyData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -843,9 +843,8 @@ bool ReaderProxyData::readFromCDRMessage(
}
case fastdds::dds::PID_NETWORK_CONFIGURATION_SET:
{
// Ignore custom PID when coming from other vendors except RTI Connext
if ((c_VendorId_eProsima != source_vendor_id) &&
(fastdds::rtps::c_VendorId_rti_connext != source_vendor_id))
// Ignore custom PID when coming from other vendors
if (c_VendorId_eProsima != source_vendor_id)
{
EPROSIMA_LOG_INFO(RTPS_PROXY_DATA,
"Ignoring custom PID" << pid << " from vendor " << source_vendor_id);
Expand Down Expand Up @@ -989,8 +988,9 @@ bool ReaderProxyData::readFromCDRMessage(

case fastdds::dds::PID_DISABLE_POSITIVE_ACKS:
{
// Ignore custom PID when coming from other vendors
if (c_VendorId_eProsima != source_vendor_id)
// Ignore custom PID when coming from other vendors except RTI Connext
if ((c_VendorId_eProsima != source_vendor_id) &&
(fastdds::rtps::c_VendorId_rti_connext != source_vendor_id))
{
EPROSIMA_LOG_INFO(RTPS_PROXY_DATA,
"Ignoring custom PID" << pid << " from vendor " << source_vendor_id);
Expand Down
10 changes: 5 additions & 5 deletions src/cpp/rtps/builtin/data/WriterProxyData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -857,9 +857,8 @@ bool WriterProxyData::readFromCDRMessage(
}
case fastdds::dds::PID_NETWORK_CONFIGURATION_SET:
{
// Ignore custom PID when coming from other vendors except RTI Connext
if ((c_VendorId_eProsima != source_vendor_id) &&
(fastdds::rtps::c_VendorId_rti_connext != source_vendor_id))
// Ignore custom PID when coming from other vendors
if (c_VendorId_eProsima != source_vendor_id)
{
EPROSIMA_LOG_INFO(RTPS_PROXY_DATA,
"Ignoring custom PID" << pid << " from vendor " << source_vendor_id);
Expand Down Expand Up @@ -971,8 +970,9 @@ bool WriterProxyData::readFromCDRMessage(
}
case fastdds::dds::PID_DISABLE_POSITIVE_ACKS:
{
// Ignore custom PID when coming from other vendors
if (c_VendorId_eProsima != source_vendor_id)
// Ignore custom PID when coming from other vendors except RTI Connext
if ((c_VendorId_eProsima != source_vendor_id) &&
(fastdds::rtps::c_VendorId_rti_connext != source_vendor_id))
{
EPROSIMA_LOG_INFO(RTPS_PROXY_DATA,
"Ignoring custom PID" << pid << " from vendor " << source_vendor_id);
Expand Down
3 changes: 2 additions & 1 deletion src/cpp/rtps/reader/WriterProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,8 @@ bool WriterProxy::perform_initial_ack_nack()
if (writer)
{
bool tmp;
writer->process_acknack(guid(), reader_->getGuid(), 1, SequenceNumberSet_t(), false, tmp);
writer->process_acknack(guid(), reader_->getGuid(), 1,
SequenceNumberSet_t(), false, tmp, c_VendorId_eProsima);
}
}
else
Expand Down
5 changes: 3 additions & 2 deletions src/cpp/rtps/writer/StatefulWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ bool StatefulWriter::intraprocess_gap(
RTPSReader* reader = reader_proxy->local_reader();
if (reader)
{
return reader->processGapMsg(m_guid, first_seq, SequenceNumberSet_t(last_seq));
return reader->processGapMsg(m_guid, first_seq, SequenceNumberSet_t(last_seq), c_VendorId_eProsima);
}

return false;
Expand Down Expand Up @@ -519,7 +519,8 @@ bool StatefulWriter::intraprocess_heartbeat(
{
incrementHBCount();
returned_value =
reader->processHeartbeatMsg(m_guid, m_heartbeatCount, first_seq, last_seq, true, liveliness);
reader->processHeartbeatMsg(m_guid, m_heartbeatCount, first_seq, last_seq, true, liveliness,
c_VendorId_eProsima);
}
}

Expand Down
35 changes: 24 additions & 11 deletions test/mock/rtps/RTPSWriter/fastdds/rtps/writer/RTPSWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,19 @@
#ifndef _FASTDDS_RTPS_RTPSWRITER_H_
#define _FASTDDS_RTPS_RTPSWRITER_H_

#include <fastrtps/rtps/attributes/WriterAttributes.h>
#include <fastrtps/rtps/writer/WriterListener.h>
#include <fastrtps/rtps/Endpoint.h>
#include <fastrtps/rtps/common/CacheChange.h>
#include <condition_variable>

#include <gmock/gmock.h>

#include <fastdds/rtps/common/VendorId_t.hpp>
#include <fastdds/rtps/interfaces/IReaderDataFilter.hpp>
#include <fastdds/rtps/messages/RTPSMessageGroup.h>
#include <fastdds/rtps/writer/DeliveryRetCode.hpp>
#include <fastdds/rtps/writer/LocatorSelectorSender.hpp>

#include <condition_variable>
#include <gmock/gmock.h>
#include <fastrtps/rtps/attributes/WriterAttributes.h>
#include <fastrtps/rtps/common/CacheChange.h>
#include <fastrtps/rtps/Endpoint.h>
#include <fastrtps/rtps/writer/WriterListener.h>

namespace eprosima {
namespace fastrtps {
Expand Down Expand Up @@ -227,9 +229,15 @@ class RTPSWriter : public Endpoint
uint32_t ack_count,
const SequenceNumberSet_t& sn_set,
bool final_flag,
bool& result)
bool& result,
fastdds::rtps::VendorId_t origin_vendor_id = c_VendorId_Unknown)
{
(void)writer_guid; (void)reader_guid; (void)ack_count; (void)sn_set; (void)final_flag;
static_cast<void>(writer_guid);
static_cast<void>(reader_guid);
static_cast<void>(ack_count);
static_cast<void>(sn_set);
static_cast<void>(final_flag);
static_cast<void>(origin_vendor_id);

result = false;
return true;
Expand All @@ -241,9 +249,14 @@ class RTPSWriter : public Endpoint
uint32_t ack_count,
const SequenceNumber_t& seq_num,
const FragmentNumberSet_t fragments_state,
bool& result)
bool& result,
fastdds::rtps::VendorId_t origin_vendor_id = c_VendorId_Unknown)
{
(void)reader_guid; (void)ack_count; (void)seq_num; (void)fragments_state;
static_cast<void>(reader_guid);
static_cast<void>(ack_count);
static_cast<void>(seq_num);
static_cast<void>(fragments_state);
static_cast<void>(origin_vendor_id);

result = false;
return writer_guid == m_guid;
Expand Down
Loading

0 comments on commit 5931f7a

Please sign in to comment.