Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repair service found that CDR serial transmission data has a maximum #5154

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ bool EDPSimple::serialize_proxy_data(
#endif // if __BIG_ENDIAN__

data.writeToCDRMessage(&aux_msg, true);
change->serializedPayload.length = (uint16_t)aux_msg.length;
change->serializedPayload.length = aux_msg.length;

if (remove_same_instance)
{
Expand Down
7 changes: 7 additions & 0 deletions test/blackbox/api/dds-pim/PubSubWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,13 @@ class PubSubWriter
return *this;
}

PubSubWriter& publisher_groupData(
std::vector<eprosima::fastdds::rtps::octet> group_data)
{
publisher_qos_.group_data() = group_data;
return *this;
}

PubSubWriter& user_data_max_size(
uint32_t max_user_data)
{
Expand Down
48 changes: 48 additions & 0 deletions test/blackbox/common/BlackboxTestsDiscovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1661,3 +1661,51 @@ TEST(Discovery, discovery_cyclone_participant_with_custom_pid)
/* Clean up */
factory->delete_participant(participant);
}

//! Using the service to discover that the total sum of USER_DATA and GROUP DATA
//! data exceeds uint16ut byte CDR regression testing
//! Regression test for support case #5154
TEST_P(Discovery, CdrWriteDataLength)
{
PubSubReader<HelloWorldPubSubType> reader(TEST_TOPIC_NAME);
PubSubWriter<HelloWorldPubSubType> writer(TEST_TOPIC_NAME);

std::size_t user_size = 65500;
std::vector<eprosima::fastdds::rtps::octet> user_data;
user_data.resize(user_size);
std::size_t group_size = 65000;
std::vector<eprosima::fastdds::rtps::octet> group_data;
group_data.resize(group_size);
writer.history_depth(100).
endpoint_userData(user_data).publisher_groupData(group_data).init();

ASSERT_TRUE(writer.isInitialized());

reader.setOnEndpointDiscoveryFunction([&writer, &user_size, &group_size](WriterDiscoveryStatus /*reason*/,
const PublicationBuiltinTopicData& info) -> bool
{
if (info.guid == writer.datawriter_guid())
{
std::cout << "Received USER_DATA size from the writer program: "
<< info.user_data.size() << std::endl;
std::cout << "Received GROUP_DATA size from the writer program: "
<< info.group_data.size() << std::endl;

return info.user_data.size() == user_size && info.group_data.size() == group_size;
}

return false;
});

reader.history_depth(100).
reliability(eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS).init();

ASSERT_TRUE(reader.isInitialized());


reader.wait_discovery();
writer.wait_discovery();

reader.wait_discovery_result();

}