Skip to content

Commit a18884f

Browse files
committed
Minor changes and moving logs
Signed-off-by: Emilio Cuesta <emiliocuesta@eprosima.com>
1 parent ae0a3f2 commit a18884f

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

src/cpp/fastdds/publisher/DataWriterImpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ ReturnCode_t DataWriterImpl::check_instance_preconditions(
778778
#if !defined(NDEBUG)
779779
if (handle.isDefined() && instance_handle != handle)
780780
{
781-
EPROSIMA_LOG_ERROR(DATA_WRITER, "handle differs from data's key.");
781+
EPROSIMA_LOG_ERROR(DATA_WRITER, "Handle differs from data's key.");
782782
return RETCODE_PRECONDITION_NOT_MET;
783783
}
784784
#endif // if !defined(NDEBUG)

src/cpp/rtps/messages/RTPSMessageGroup.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ bool RTPSMessageGroup::add_data(
631631
if (!RTPSMessageCreator::addSubmessageData(submessage_msg_, &change_to_add, endpoint_->getAttributes().topicKind,
632632
readerId, expectsInlineQos, inline_qos, is_big_submessage, copy_data, pending_buffer_, pending_padding_))
633633
{
634-
EPROSIMA_LOG_ERROR(RTPS_WRITER, "Cannot add DATA submsg to the CDRMessage. Buffer too small");
634+
EPROSIMA_LOG_ERROR(RTPS_WRITER, "Cannot add DATA submsg to the CDRMessage. Either buffer is too small or handle was required and not set");
635635
change_to_add.serializedPayload.data = nullptr;
636636
return false;
637637
}
@@ -750,7 +750,7 @@ bool RTPSMessageGroup::add_data_frag(
750750
change_to_add.serializedPayload, endpoint_->getAttributes().topicKind, readerId,
751751
expectsInlineQos, inline_qos, copy_data, pending_buffer_, pending_padding_))
752752
{
753-
EPROSIMA_LOG_ERROR(RTPS_WRITER, "Cannot add DATA_FRAG submsg to the CDRMessage. Buffer too small");
753+
EPROSIMA_LOG_ERROR(RTPS_WRITER, "Cannot add DATA_FRAG submsg to the CDRMessage. Either buffer is too small or handle was required and not set");
754754
change_to_add.serializedPayload.data = nullptr;
755755
return false;
756756
}

src/cpp/rtps/messages/submessages/DataMsg.hpp

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,16 +167,8 @@ struct DataMsgUtils
167167
}
168168
else
169169
{
170-
if (ALIVE != change->kind || expectsInlineQos)
171-
{
172-
EPROSIMA_LOG_ERROR(RTPS_WRITER,
173-
"Changes in KEYED Writers need a valid instanceHandle. The behavior is undefined");
174-
}
175-
else
176-
{
177-
EPROSIMA_LOG_WARNING(RTPS_WRITER,
178-
"Changes in KEYED Writers need a valid instanceHandle. The data will be handled as if it came from an unkeyed topic.");
179-
}
170+
EPROSIMA_LOG_WARNING(RTPS_WRITER,
171+
"Change does not have a valid instanceHandle. KEY_HASH will not be serialized.");
180172
}
181173
}
182174

@@ -279,6 +271,15 @@ bool RTPSMessageCreator::addSubmessageData(
279271
//Add INLINE QOS AND SERIALIZED PAYLOAD DEPENDING ON FLAGS:
280272
if (inlineQosFlag) //inlineQoS
281273
{
274+
if(WITH_KEY == topicKind &&
275+
change->instanceHandle.isDefined() == false &&
276+
(expectsInlineQos || change->kind != ALIVE))
277+
{
278+
// Instance handle is required but not defined
279+
EPROSIMA_LOG_ERROR(RTPS_WRITER,
280+
"Changes in KEYED Writers need a valid instanceHandle. Message won't be serialized");
281+
return false;
282+
}
282283
DataMsgUtils::serialize_inline_qos(msg, change, topicKind, expectsInlineQos, inlineQos, status);
283284
}
284285

@@ -469,6 +470,15 @@ bool RTPSMessageCreator::addSubmessageDataFrag(
469470
//Add INLINE QOS AND SERIALIZED PAYLOAD DEPENDING ON FLAGS:
470471
if (inlineQosFlag) //inlineQoS
471472
{
473+
if(WITH_KEY == topicKind &&
474+
change->instanceHandle.isDefined() == false &&
475+
(expectsInlineQos || change->kind != ALIVE))
476+
{
477+
// Instance handle is required but not defined
478+
EPROSIMA_LOG_ERROR(RTPS_WRITER,
479+
"Changes in KEYED Writers need a valid instanceHandle. Message won't be serialized");
480+
return false;
481+
}
472482
DataMsgUtils::serialize_inline_qos(msg, change, topicKind, expectsInlineQos, inlineQos, status);
473483
}
474484

0 commit comments

Comments
 (0)