Skip to content

Commit

Permalink
Refs #9293. Check after parsing, adding comment on workaround.
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
  • Loading branch information
MiguelCompany committed Sep 11, 2020
1 parent d45f3e0 commit 3819bf7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
19 changes: 12 additions & 7 deletions src/cpp/rtps/builtin/data/ReaderProxyData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,13 +788,6 @@ bool ReaderProxyData::readFromCDRMessage(
m_guid = p.guid;
memcpy(m_key.value, p.guid.guidPrefix.value, 12);
memcpy(m_key.value + 12, p.guid.entityId.value, 4);

if (!m_RTPSParticipantKey.isDefined())
{
p.guid.entityId = c_EntityId_RTPSParticipant;
memcpy(m_RTPSParticipantKey.value, p.guid.guidPrefix.value, 12);
memcpy(m_RTPSParticipantKey.value + 12, p.guid.entityId.value, 4);
}
break;
}
case fastdds::dds::PID_UNICAST_LOCATOR:
Expand Down Expand Up @@ -971,6 +964,18 @@ bool ReaderProxyData::readFromCDRMessage(
m_topicKind = WITH_KEY;
}

/* Some vendors (i.e. CycloneDDS) do not follow DDSI-RTPS and omit PID_PARTICIPANT_GUID
* In that case we use a default value relying on the prefix from m_guid and the default
* participant entity id
*/
if (!m_RTPSParticipantKey.isDefined())
{
GUID_t tmp_guid = m_guid;
tmp_guid.entityId = c_EntityId_RTPSParticipant;
memcpy(m_RTPSParticipantKey.value, tmp_guid.guidPrefix.value, 12);
memcpy(m_RTPSParticipantKey.value + 12, tmp_guid.entityId.value, 4);
}

return true;
}
}
Expand Down
20 changes: 13 additions & 7 deletions src/cpp/rtps/builtin/data/WriterProxyData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -804,13 +804,6 @@ bool WriterProxyData::readFromCDRMessage(
m_guid = p.guid;
memcpy(m_key.value, p.guid.guidPrefix.value, 12);
memcpy(m_key.value + 12, p.guid.entityId.value, 4);

if (!m_RTPSParticipantKey.isDefined())
{
p.guid.entityId = c_EntityId_RTPSParticipant;
memcpy(m_RTPSParticipantKey.value, p.guid.guidPrefix.value, 12);
memcpy(m_RTPSParticipantKey.value + 12, p.guid.entityId.value, 4);
}
break;
}
case fastdds::dds::PID_PERSISTENCE_GUID:
Expand Down Expand Up @@ -980,6 +973,19 @@ bool WriterProxyData::readFromCDRMessage(
{
m_topicKind = WITH_KEY;
}

/* Some vendors (i.e. CycloneDDS) do not follow DDSI-RTPS and omit PID_PARTICIPANT_GUID
* In that case we use a default value relying on the prefix from m_guid and the default
* participant entity id
*/
if (!m_RTPSParticipantKey.isDefined())
{
GUID_t tmp_guid = m_guid;
tmp_guid.entityId = c_EntityId_RTPSParticipant;
memcpy(m_RTPSParticipantKey.value, tmp_guid.guidPrefix.value, 12);
memcpy(m_RTPSParticipantKey.value + 12, tmp_guid.entityId.value, 4);
}

return true;
}
}
Expand Down

0 comments on commit 3819bf7

Please sign in to comment.