Skip to content

Commit

Permalink
Refs 12051. Notification can be file shared too
Browse files Browse the repository at this point in the history
Signed-off-by: Iker Luengo <ikerluengo@eprosima.com>
  • Loading branch information
IkerLuengo committed Aug 31, 2021
1 parent 2800cb2 commit add6067
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
24 changes: 20 additions & 4 deletions src/cpp/rtps/DataSharing/DataSharingNotification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,32 @@ bool DataSharingNotification::create_and_init_notification(
const GUID_t& reader_guid,
const std::string& shared_dir)
{
return create_and_init_shared_segment_notification<fastdds::rtps::SharedMemSegment>(reader_guid,
shared_dir);
if (shared_dir.empty())
{
return create_and_init_shared_segment_notification<fastdds::rtps::SharedMemSegment>(reader_guid,
shared_dir);
}
else
{
return create_and_init_shared_segment_notification<fastdds::rtps::SharedFileSegment>(reader_guid,
shared_dir);
}
}

bool DataSharingNotification::open_and_init_notification(
const GUID_t& reader_guid,
const std::string& shared_dir)
{
return open_and_init_shared_segment_notification<fastdds::rtps::SharedMemSegment>(reader_guid,
shared_dir);
if (shared_dir.empty())
{
return open_and_init_shared_segment_notification<fastdds::rtps::SharedMemSegment>(reader_guid,
shared_dir);
}
else
{
return open_and_init_shared_segment_notification<fastdds::rtps::SharedFileSegment>(reader_guid,
shared_dir);
}
}

void DataSharingNotification::destroy()
Expand Down
6 changes: 3 additions & 3 deletions src/cpp/rtps/DataSharing/DataSharingNotification.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class DataSharingNotification
catch (const std::exception& e)
{
logError(HISTORY_DATASHARING_LISTENER, "Failed to create segment " << segment_name_
<< ": " << e.what());
<< ": " << e.what());
return false;
}

Expand All @@ -167,7 +167,7 @@ class DataSharingNotification
T::remove(segment_name_);

logError(HISTORY_DATASHARING_LISTENER, "Failed to create listener queue " << segment_name_
<< ": " << e.what());
<< ": " << e.what());
return false;
}

Expand Down Expand Up @@ -195,7 +195,7 @@ class DataSharingNotification
catch (const std::exception& e)
{
logError(HISTORY_DATASHARING_LISTENER, "Failed to open segment " << segment_name_
<< ": " << e.what());
<< ": " << e.what());
return false;
}

Expand Down

0 comments on commit add6067

Please sign in to comment.