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

[config] Move host_group_name logic #1720

Merged
merged 2 commits into from
Aug 23, 2024
Merged
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
15 changes: 7 additions & 8 deletions ecal/core/include/ecal/config/registration.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#pragma once

#include "ecal/ecal_os.h"
#include "ecal/ecal_process.h"

#include <stdexcept>
#include <string>
Expand Down Expand Up @@ -64,14 +63,14 @@ namespace eCAL

struct Configuration
{
unsigned int registration_timeout { 10000U }; //!< Timeout for topic registration in ms (internal) (Default: 10000)
unsigned int registration_refresh { 1000U }; //!< Topic registration refresh cylce (has to be smaller then registration timeout!) (Default: 1000)
unsigned int registration_timeout { 10000U }; //!< Timeout for topic registration in ms (internal) (Default: 10000)
unsigned int registration_refresh { 1000U }; //!< Topic registration refresh cylce (has to be smaller then registration timeout!) (Default: 1000)

bool network_enabled { false }; /*!< true = all eCAL components communicate over network boundaries
false = local host only communication (Default: false) */
bool loopback { true }; //!< enable to receive udp messages on the same local machine (Default: true)
std::string host_group_name { eCAL::Process::GetHostName() }; /*!< Common host group name that enables interprocess mechanisms across
(virtual) host borders (e.g, Docker); by default equivalent to local host name (Default: CurrentHostName) */
bool network_enabled { false }; /*!< true = all eCAL components communicate over network boundaries
false = local host only communication (Default: false) */
bool loopback { true }; //!< enable to receive udp messages on the same local machine (Default: true)
std::string host_group_name { "" }; /*!< Common host group name that enables interprocess mechanisms across
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: redundant string initialization [readability-redundant-string-init]

Suggested change
std::string host_group_name { "" }; /*!< Common host group name that enables interprocess mechanisms across
std::string host_group_name; /*!< Common host group name that enables interprocess mechanisms across

(virtual) host borders (e.g, Docker); by default equivalent to local host name (Default: "") */
Layer::Configuration layer;
};
}
Expand Down
13 changes: 12 additions & 1 deletion ecal/core/src/builder/registration_attribute_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#include "registration_attribute_builder.h"
#include "ecal/ecal_process.h"

namespace eCAL
{
Expand All @@ -29,7 +30,17 @@ namespace eCAL
attr.refresh = reg_config_.registration_refresh;
attr.network_enabled = reg_config_.network_enabled;
attr.loopback = reg_config_.loopback;
attr.host_group_name = reg_config_.host_group_name;

// TODO: Check the usage further down of host_group_name -> logic currenty missleading
if (reg_config_.host_group_name.empty())
{
attr.host_group_name = eCAL::Process::GetHostName();
}
else
{
attr.host_group_name = reg_config_.host_group_name;
}

attr.process_id = process_id_;

attr.shm_enabled = reg_config_.layer.shm.enable;
Expand Down
Loading