Skip to content

Commit

Permalink
Refs #21121: Avoid unsetting payload_owner
Browse files Browse the repository at this point in the history
Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>
  • Loading branch information
cferreiragonz committed Jun 5, 2024
1 parent 5f9519b commit 0588ba0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
11 changes: 2 additions & 9 deletions src/cpp/rtps/reader/StatefulReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -624,13 +624,10 @@ bool StatefulReader::processDataMsg(
// Copy metadata to reserved change
change_to_add->copy_not_memcpy(change);

// Ask payload pool to copy the payload
IPayloadPool* payload_owner = change->payload_owner();

if (is_datasharing_compatible_ && datasharing_listener_->writer_is_matched(change->writerGUID))
{
// We may receive the change from the listener (with owner a ReaderPool) or intraprocess (with owner a WriterPool)
ReaderPool* datasharing_pool = dynamic_cast<ReaderPool*>(payload_owner);
ReaderPool* datasharing_pool = dynamic_cast<ReaderPool*>(change->payload_owner());
if (!datasharing_pool)
{
datasharing_pool = datasharing_listener_->get_pool_for_writer(change->writerGUID).get();
Expand All @@ -644,11 +641,7 @@ bool StatefulReader::processDataMsg(
}
datasharing_pool->get_datasharing_change(change->serializedPayload, *change_to_add);
}
else if (payload_pool_->get_payload(change->serializedPayload, change_to_add->serializedPayload))
{
change->payload_owner(payload_owner);
}
else
else if (!payload_pool_->get_payload(change->serializedPayload, change_to_add->serializedPayload))
{
EPROSIMA_LOG_WARNING(RTPS_MSG_IN, IDSTRING "Problem copying CacheChange, received data is: "
<< change->serializedPayload.length << " bytes and max size in reader "
Expand Down
11 changes: 2 additions & 9 deletions src/cpp/rtps/reader/StatelessReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,6 @@ bool StatelessReader::processDataMsg(
// Copy metadata to reserved change
change_to_add->copy_not_memcpy(change);

// Ask payload pool to copy the payload
IPayloadPool* payload_owner = change->payload_owner();

bool is_datasharing = std::any_of(matched_writers_.begin(), matched_writers_.end(),
[&change](const RemoteWriterInfo_t& writer)
{
Expand All @@ -624,7 +621,7 @@ bool StatelessReader::processDataMsg(
if (is_datasharing)
{
//We may receive the change from the listener (with owner a ReaderPool) or intraprocess (with owner a WriterPool)
ReaderPool* datasharing_pool = dynamic_cast<ReaderPool*>(payload_owner);
ReaderPool* datasharing_pool = dynamic_cast<ReaderPool*>(change->payload_owner());
if (!datasharing_pool)
{
datasharing_pool = datasharing_listener_->get_pool_for_writer(change->writerGUID).get();
Expand All @@ -638,11 +635,7 @@ bool StatelessReader::processDataMsg(
}
datasharing_pool->get_datasharing_change(change->serializedPayload, *change_to_add);
}
else if (payload_pool_->get_payload(change->serializedPayload, change_to_add->serializedPayload))
{
change->payload_owner(payload_owner);
}
else
else if (!payload_pool_->get_payload(change->serializedPayload, change_to_add->serializedPayload))
{
EPROSIMA_LOG_WARNING(RTPS_MSG_IN, IDSTRING "Problem copying CacheChange, received data is: "
<< change->serializedPayload.length << " bytes and max size in reader "
Expand Down

0 comments on commit 0588ba0

Please sign in to comment.