Skip to content

Commit

Permalink
Default services to preallocated with realloc (#310)
Browse files Browse the repository at this point in the history
* Default services to preallocated with realloc

Signed-off-by: Pablo Garrido <pablogs9@gmail.com>

* Add replier

Signed-off-by: Pablo Garrido <pablogs9@gmail.com>
  • Loading branch information
pablogs9 authored Apr 25, 2022
1 parent e8c7cb8 commit a1f412b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/cpp/middleware/fastdds/FastDDSMiddleware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,9 @@ bool FastDDSMiddleware::create_requester_by_bin(
attrs.subscriber.topic.topicName = requester_xrce.reply_topic_name();
attrs.subscriber.topic.topicDataType = requester_xrce.reply_type();

attrs.publisher.historyMemoryPolicy = fastrtps::rtps::PREALLOCATED_WITH_REALLOC_MEMORY_MODE;
attrs.subscriber.historyMemoryPolicy = fastrtps::rtps::PREALLOCATED_WITH_REALLOC_MEMORY_MODE;

std::shared_ptr<FastDDSRequester> requester = create_requester(participant, attrs);
if (nullptr == requester)
{
Expand Down Expand Up @@ -692,7 +695,10 @@ bool FastDDSMiddleware::create_replier_by_bin(
attrs.subscriber.topic.topicDataType = replier_xrce.request_type();

attrs.publisher.topic.topicName = replier_xrce.reply_topic_name();
attrs.publisher.topic.topicDataType = replier_xrce.reply_type();
attrs.publisher.topic.topicDataType = replier_xrce.reply_type();

attrs.publisher.historyMemoryPolicy = fastrtps::rtps::PREALLOCATED_WITH_REALLOC_MEMORY_MODE;
attrs.subscriber.historyMemoryPolicy = fastrtps::rtps::PREALLOCATED_WITH_REALLOC_MEMORY_MODE;

std::shared_ptr<FastDDSReplier> replier = create_replier(participant, attrs);
if (nullptr == replier)
Expand Down Expand Up @@ -894,7 +900,7 @@ bool FastDDSMiddleware::read_data(
{
fastdds::dds::SampleInfo sample_info;
rv = it->second->read(data, timeout, sample_info);

if (intraprocess_enabled_)
{
for (auto dw = datawriters_.begin(); dw != datawriters_.end(); dw++)
Expand Down

0 comments on commit a1f412b

Please sign in to comment.