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

[core] new-datarw-connection-logic #1729

Merged
merged 5 commits into from
Sep 6, 2024

Conversation

rex-schilasky
Copy link
Contributor

Description

Refactor connection state logic for DataReader/Writer (Sub/Pub)

  • Corrected connection state handling to trigger IsPublished()/IsSubscribed() and (corresponding connection state events) only when the connection is fully established.
  • Using a second registration loop to ensure connections become fully active.
  • Send() and Receive() functions remain unaffected by the new state management.
  • Added tests to validate correct behavior of IsPublished() and IsSubscribed() methods.

…get IsPublished/IsSubscribed (and the connection events) only if the connection is fully established

connection state need now a second registration loop to get fully active
Send(), Receive() functions are not affected by the new state handling
test added to check correct IsPublished() and IsSubscribed() behavior
Copy link
Contributor

@github-actions github-actions bot left a 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

#include <string>
#include <thread>

#include <gtest/gtest.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'gtest/gtest.h' file not found [clang-diagnostic-error]

#include <gtest/gtest.h>
         ^


#include <gtest/gtest.h>

TEST(core_cpp_pubsub, TestSubscriberIsPublishedTiming)
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: all parameters should be named in a function [readability-named-parameter]

Suggested change
TEST(core_cpp_pubsub, TestSubscriberIsPublishedTiming)
TEST(core_cpp_pubsub /*unused*/, TestSubscriberIsPublishedTiming /*unused*/)

std::string first_received_sample;
auto subscriber_thread = [&]() {
eCAL::CSubscriber sub("blob");
bool received(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'received' of type 'bool' can be declared 'const' [misc-const-correctness]

Suggested change
bool received(false);
bool const received(false);

eCAL::Finalize();
}

TEST(core_cpp_pubsub, TestPublisherIsSubscribedTiming)
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: all parameters should be named in a function [readability-named-parameter]

Suggested change
TEST(core_cpp_pubsub, TestPublisherIsSubscribedTiming)
TEST(core_cpp_pubsub /*unused*/, TestPublisherIsSubscribedTiming /*unused*/)

std::string first_received_sample;
auto subscriber_thread = [&]() {
eCAL::CSubscriber sub("blob");
bool received(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'received' of type 'bool' can be declared 'const' [misc-const-correctness]

Suggested change
bool received(false);
bool const received(false);

@rex-schilasky rex-schilasky added the cherry-pick-to-NONE Don't cherry-pick these changes label Sep 5, 2024
Copy link
Contributor

@Peguen Peguen left a comment

Choose a reason for hiding this comment

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

💻 lgtm 👍

@rex-schilasky rex-schilasky merged commit 9ba6e21 into master Sep 6, 2024
20 checks passed
@rex-schilasky rex-schilasky deleted the feature/new-datarw-connection-logic branch September 6, 2024 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-to-NONE Don't cherry-pick these changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants