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

service client connection state handling #1780

Merged

Conversation

rex-schilasky
Copy link
Contributor

Description

Service client connection state (IsConnected) now handled correctly. Connection state is true if a matching server (at least one) is connected on lower client/service API level. We might change this API even more to return the states of all matching server.

Related issues

#1779

Cherry-pick to

@rex-schilasky rex-schilasky added the cherry-pick-to-support/v5.13 Cherry pick these changes to support/v5.13 label Nov 5, 2024
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

std::lock_guard<std::mutex> const lock(m_client_map_sync);
auto client = m_client_map.find(service.key);
if (client != m_client_map.end())
auto& client_data = client.second;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'auto &client_data' can be declared as 'const auto &client_data' [readability-qualified-auto]

Suggested change
auto& client_data = client.second;
const auto& client_data = client.second;

// check connections
std::lock_guard<std::mutex> const lock(m_connected_services_map_sync);
// lock client map
std::lock_guard<std::mutex> lock(m_client_map_sync);
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 'lock' of type 'std::lock_guardstd::mutex' can be declared 'const' [misc-const-correctness]

Suggested change
std::lock_guard<std::mutex> lock(m_client_map_sync);
std::lock_guard<std::mutex> const lock(m_client_map_sync);

{
// Lock mutex for iterating over client session map
std::lock_guard<std::mutex> const client_map_lock(m_client_map_sync);
auto& client_data = client.second;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'auto &client_data' can be declared as 'const auto &client_data' [readability-qualified-auto]

Suggested change
auto& client_data = client.second;
const auto& client_data = client.second;

std::lock_guard<std::mutex> const lock(m_client_map_sync);
auto client = m_client_map.find(iter.key);
if (client == m_client_map.end())
auto& client_key = it->first;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'auto &client_key' can be declared as 'const auto &client_key' [readability-qualified-auto]

Suggested change
auto& client_key = it->first;
const auto& client_key = it->first;

@rex-schilasky rex-schilasky merged commit fe2a857 into master Nov 6, 2024
20 checks passed
@rex-schilasky rex-schilasky deleted the hotfix/service-client-connection-state-handling branch November 6, 2024 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-to-support/v5.13 Cherry pick these changes to support/v5.13
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants