Skip to content

Commit a7dcb2f

Browse files
adolfomarverMiguelCompany
authored andcommitted
SHM Buffer recovery mechanishm (#1159)
* Refs #8219. Change BufferNode to pre-allocated pool with fixed addresses for the nodes during entire life-cycle. Signed-off-by: AdolfoMartinez <[email protected]> * Refs #8219. SHM Buffer invalidation implementation. Signed-off-by: AdolfoMartinez <[email protected]> * Refs #8219. logWarning -> logInfo when segment overflow. Signed-off-by: AdolfoMartinez <[email protected]> * Refs #8219. Optimization. Signed-off-by: AdolfoMartinez <[email protected]> * Refs #8219. Style changes. Signed-off-by: AdolfoMartinez <[email protected]> * Refs #8219. buffer_recover test. Signed-off-by: AdolfoMartinez <[email protected]> * Refs #8219. 'error:' string removed from log msg. Signed-off-by: AdolfoMartinez <[email protected]>
1 parent 1fa19ae commit a7dcb2f

File tree

4 files changed

+577
-181
lines changed

4 files changed

+577
-181
lines changed

src/cpp/rtps/transport/shared_mem/SharedMemGlobal.hpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,9 @@ class SharedMemGlobal
7272
*/
7373
struct BufferDescriptor
7474
{
75-
alignas(8) uint32_t flags;
76-
uint64_t enqueue_tick;
7775
SharedMemSegment::Id source_segment_id;
7876
SharedMemSegment::Offset buffer_node_offset;
77+
uint32_t validity_id;
7978
};
8079

8180
typedef MultiProducerConsumerRingBuffer<BufferDescriptor>::Listener Listener;
@@ -358,7 +357,7 @@ class SharedMemGlobal
358357
(*port_it)->node->is_port_ok = false;
359358

360359
logWarning(RTPS_TRANSPORT_SHM, "Port " << (*port_it)->node->port_id
361-
<< " error: " << e.what());
360+
<< ": " << e.what());
362361

363362
// Remove the port from watch
364363
port_it = watched_ports_.erase(port_it);
@@ -791,7 +790,7 @@ class SharedMemGlobal
791790
}
792791

793792
try
794-
{
793+
{
795794
port->healthy_check();
796795

797796
if ( (port_node->is_opened_read_exclusive && open_mode != Port::OpenMode::Write) ||
@@ -867,6 +866,16 @@ class SharedMemGlobal
867866
return port;
868867
}
869868

869+
/**
870+
* Remove a port from the system.
871+
*/
872+
void remove_port(
873+
uint32_t port_id)
874+
{
875+
auto port_segment_name = domain_name_ + "_port" + std::to_string(port_id);
876+
SharedMemSegment::remove(port_segment_name.c_str());
877+
}
878+
870879
private:
871880

872881
std::string domain_name_;

0 commit comments

Comments
 (0)