From d53fab764a6cb95e77a7d02f5cb5f200717392d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Dom=C3=ADnguez=20L=C3=B3pez?= <116071334+Mario-DL@users.noreply.github.com> Date: Sat, 8 Jun 2024 07:50:27 +0200 Subject: [PATCH] Make explicit the need to keep alive the flow controller descriptor name (#806) * Refs #21054: Make explicit the need for keeping alive participants flow controller descriptor name Signed-off-by: Mario Dominguez * Refs #21054: Missing ; Signed-off-by: Mario Dominguez * Refs #21054: Apply suggestions --------- Signed-off-by: Mario Dominguez Co-authored-by: Eduardo Ponz Segrelles --- code/DDSCodeTester.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/DDSCodeTester.cpp b/code/DDSCodeTester.cpp index fe7f31273..8e28962d3 100644 --- a/code/DDSCodeTester.cpp +++ b/code/DDSCodeTester.cpp @@ -4094,8 +4094,11 @@ void dds_qos_examples() //The PublishModeQosPolicy is default constructed with kind = SYNCHRONOUS //Change the kind to ASYNCHRONOUS publish_mode.kind = ASYNCHRONOUS_PUBLISH_MODE; + // Optionally, select the flow controller name - publish_mode.flow_controller_name = "example_flow_controller"; + // Important: the flow_controller_name must be kept alive during the Participant's lifetime. + static std::string flow_controller_name{"example_flow_controller"}; + publish_mode.flow_controller_name = flow_controller_name.c_str(); //!-- } @@ -5409,6 +5412,7 @@ void dds_usecase_examples() { //CONF-QOS-FLOWCONTROLLER // Limit to 300kb per second. + // Important: the flow_controller_name must be kept alive during the Participant's lifetime. static const char* flow_controller_name = "example_flow_controller"; auto flow_control_300k_per_sec = std::make_shared(); flow_control_300k_per_sec->name = flow_controller_name;