-
Notifications
You must be signed in to change notification settings - Fork 174
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
feature/entity-unregistration #1086
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
@@ -137,8 +137,7 @@ namespace eCAL | |||
RemReceiveCallback(); | |||
|
|||
// first unregister data reader | |||
if(g_subgate()) g_subgate()->Unregister(m_datareader->GetTopicName(), m_datareader); | |||
if(g_registration_provider()) g_registration_provider()->UnregisterTopic(m_datareader->GetTopicName(), m_datareader->GetTopicID()); | |||
if(g_subgate()) g_subgate()->Unregister(m_datareader->GetTopicName(), m_datareader); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: implicit conversion 'eCAL::CSubGate *' -> bool [readability-implicit-bool-conversion]
if(g_subgate()) g_subgate()->Unregister(m_datareader->GetTopicName(), m_datareader); | |
if(g_subgate() != nullptr) g_subgate()->Unregister(m_datareader->GetTopicName(), m_datareader); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment regarding the expmap.
The rest in general looks good, but it's a bit much to really tell if everythingis ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
@@ -222,70 +216,42 @@ namespace eCAL | |||
case eCAL::pb::bct_reg_process: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: switch has 2 consecutive identical branches [bugprone-branch-clone]
case eCAL::pb::bct_reg_process:
^
Additional context
ecal/core/src/ecal_registration_receiver.cpp:220: last of these clones ends here
break;
^
size_t ret_size(0); | ||
if (g_subgate()) ret_size = g_subgate()->ApplySample(topic_name_, topic_id_, buf_, len_, id_, clock_, time_, hash_, eCAL::pb::tl_ecal_shm); | ||
return ret_size; | ||
if (g_subgate()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: implicit conversion 'eCAL::CSubGate *' -> bool [readability-implicit-bool-conversion]
if (g_subgate()) | |
if (g_subgate() != nullptr) |
{ | ||
if (!g_subgate()) return 0; | ||
if (!g_subgate()) return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: implicit conversion 'eCAL::CSubGate *' -> bool [readability-implicit-bool-conversion]
if (!g_subgate()) return false; | |
if (g_subgate() == nullptr) return false; |
@@ -40,7 +40,7 @@ namespace eCAL | |||
{ | |||
public: | |||
bool HasSample(const std::string& sample_name_); | |||
size_t ApplySample(const eCAL::pb::Sample& ecal_sample_, eCAL::pb::eTLayerType layer_); | |||
bool ApplySample(const eCAL::pb::Sample& ecal_sample_, eCAL::pb::eTLayerType layer_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: annotate this function with 'override' or (rarely) 'final' [cppcoreguidelines-explicit-virtual-functions]
bool ApplySample(const eCAL::pb::Sample& ecal_sample_, eCAL::pb::eTLayerType layer_); | |
bool ApplySample(const eCAL::pb::Sample& ecal_sample_, eCAL::pb::eTLayerType layer_) override; |
…ct memory files that are read and written in the same process
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
std::string memfile_event = memfile_name + "_" + process_id; | ||
MemFileDataCallbackT memfile_data_callback = std::bind(&CSHMReaderLayer::OnNewShmFileContent, this, | ||
const std::string process_id = std::to_string(Process::GetProcessID()); | ||
const std::string memfile_event = memfile_name + "_" + process_id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation]
const std::string memfile_event = memfile_name + "_" + process_id;
^
@@ -41,7 +40,7 @@ | |||
|
|||
namespace eCAL | |||
{ | |||
std::mutex CDataWriterTCP::g_tcp_writer_executor_mtx; | |||
std::mutex CDataWriterTCP::g_tcp_writer_executor_mtx; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'g_tcp_writer_executor_mtx' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]
std::mutex CDataWriterTCP::g_tcp_writer_executor_mtx;
^
friendly welcome and goodbye messages (Initialize & Finalize) logic fix in ecal.cpp and ecalc.cpp for GetVersion()
uname added to unregistration info
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
void RefreshRegistrations(); | ||
|
||
protected: | ||
static std::atomic<bool> m_created; | ||
static std::atomic<bool> m_created; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'm_created' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]
static std::atomic<bool> m_created;
^
@@ -104,18 +102,18 @@ namespace eCAL | |||
// create new sample | |||
m_ecal_sample.Clear(); | |||
m_ecal_sample.set_cmd_type(eCAL::pb::bct_set_sample); | |||
auto ecal_sample_mutable_topic = m_ecal_sample.mutable_topic(); | |||
auto *ecal_sample_mutable_topic = m_ecal_sample.mutable_topic(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this not introduce a different behavior?
@@ -654,10 +657,14 @@ namespace eCAL | |||
void CDataWriter::ApplyLocSubscription(const std::string& process_id_, const std::string& tid_, const std::string& ttype_, const std::string& tdesc_, const std::string& reader_par_) | |||
{ | |||
Connect(tid_, ttype_, tdesc_); | |||
|
|||
// add key to local subscriber map | |||
const std::string topic_key = process_id_ + tid_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This introduces unwanted side-effects!
Introduces two new structs (SLocalSubscriptionInfo and SExternSubscriptionInfo) and uses them for applying / unapplying registrations. They are also stored in the ExpiredMap when topic are no longer visible on monitoring layer.
Introduces two new structs (SLocalSubscriptionInfo and SExternSubscriptionInfo) and uses them for applying / unapplying registrations. They are also stored in the ExpiredMap when topic are no longer visible on monitoring layer.
Introduces two new structs (SLocalSubscriptionInfo and SExternSubscriptionInfo) and uses them for applying / unapplying registrations. They are also stored in the ExpiredMap when topic are no longer visible on monitoring layer.
Introduces two new structs (SLocalSubscriptionInfo and SExternSubscriptionInfo) and uses them for applying / unapplying registrations. They are also stored in the ExpiredMap when topic are no longer visible on monitoring layer.
Pull request type
What is the current behavior?
Destroyed entities (publisher, subscriber, client, server) do not active unregister from the monitoring layer. These entities are removed after a monitoring timeout that can be defined in the global configuration ecal.ini file (
[monitoring]/timeout
).What is the new behavior?
New additional unregistration messages are fired by all ecal entities on destruction. Entities disappear immediately from the monitoring layer.