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

Fix applying heart_beat_timeout_ms from PreDataConsent #1551

Merged

Conversation

VVeremjova
Copy link
Contributor

After sending SDL.OnAllowSDLFunctionality(allowed = false) application is assigned to PreDataConsent group.
After this HB timeout is set to timeout from PreDataConsent

@VVeremjova VVeremjova requested a review from LuxoftAKutsan May 18, 2017 06:37
@VVeremjova
Copy link
Contributor Author

@okozlovlux, @LevchenkoS, @LitvinenkoIra please review

void PolicyHandler::SetHeartBeatTimeout(const std::string& policy_app_id,
uint32_t app_id) {
LOG4CXX_AUTO_TRACE(logger_);
int timeout = policy_manager_->HeartBeatTimeout(policy_app_id);
Copy link
Contributor

Choose a reason for hiding this comment

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

@VVeremjova const and probably uint32_t

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CACHE_MANAGER_CHECK(0);
uint32_t result = 0;
if (!IsApplicationRepresented(app_id)) {
LOG4CXX_DEBUG(logger_, "App is not represented");
Copy link
Contributor

Choose a reason for hiding this comment

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

@VVeremjova please print there app_id. And probably it is warning? No?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -415,6 +418,15 @@ void CacheManager::ProcessUpdate(
const std::string& app_id = initial_policy_iter->first;
RequestTypes merged_pt_request_types;

if (app_id == kPreDataConsentId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@VVeremjova invert comparator please :

kPreDataConsentId == app_id

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -415,6 +418,15 @@ void CacheManager::ProcessUpdate(
const std::string& app_id = initial_policy_iter->first;
RequestTypes merged_pt_request_types;

if (app_id == kPreDataConsentId) {
*(pt_->policy_table.app_policies_section.apps[app_id]
Copy link
Contributor

Choose a reason for hiding this comment

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

@VVeremjova please extract long string to local variable to better read

Copy link
Contributor Author

Choose a reason for hiding this comment

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

application_manager_.connection_handler().SetHeartBeatTimeout(app_id,
timeout);
} else {
LOG4CXX_INFO(logger_, "SetHeartBeatTimeout for " << app_id << " ignored");
Copy link
Contributor

Choose a reason for hiding this comment

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

@VVeremjova is it info?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -479,6 +479,8 @@ class PolicyHandler : public PolicyHandlerInterface,
*/
void LinkAppsToDevice();

void SetHeartBeatTimeout(const std::string& policy_app_id, uint32_t app_id);
Copy link
Contributor

Choose a reason for hiding this comment

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

@VVeremjova uint32_t app_id can be const?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@LuxoftAKutsan
Copy link
Contributor

@VVeremjova please add @dcherniev @indlu to review

Copy link

@ATymchenko ATymchenko left a comment

Choose a reason for hiding this comment

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

@VVeremjova, reviewed

Copy link
Contributor

@dcherniev dcherniev left a comment

Choose a reason for hiding this comment

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

@VVeremjova Reviewed.

@VVeremjova VVeremjova force-pushed the fix/FixApplyHBTimeoutFromPreData branch from 5400318 to e0bb7ba Compare May 19, 2017 06:54
@JenkinsSDLOnCloud
Copy link

Can one of the admins verify this patch?

2 similar comments
@JenkinsSDLOnCloud
Copy link

Can one of the admins verify this patch?

@JenkinsSDLOnCloud
Copy link

Can one of the admins verify this patch?

@LitvinenkoIra LitvinenkoIra changed the base branch from develop to release/5.0.0 September 26, 2018 11:02
Veronica Veremjova added 3 commits September 26, 2018 14:05
After sending SDL.OnAllowSDLFunctionality(allowed = false) application is assigned to PreDataConsent group.
After this HB timeout is set to timeout from PreDataConsent
@LitvinenkoIra LitvinenkoIra force-pushed the fix/FixApplyHBTimeoutFromPreData branch from e0bb7ba to ef93b27 Compare September 26, 2018 11:08
@iCollin iCollin changed the base branch from release/5.0.0 to develop November 16, 2020 22:13
Copy link
Collaborator

@iCollin iCollin left a comment

Choose a reason for hiding this comment

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

the LOG4CXX calls will need to be updated to the new abstract log macros as well

@@ -2154,6 +2167,10 @@ bool policy::CacheManager::SetIsPredata(const std::string& app_id) {
if (IsApplicationRepresented(app_id)) {
pt_->policy_table.app_policies_section.apps[app_id].set_to_string(
kPreDataConsentId);

pt_->policy_table.app_policies_section.apps[app_id].heart_beat_timeout_ms =
Copy link
Collaborator

@iCollin iCollin Nov 16, 2020

Choose a reason for hiding this comment

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

am I misunderstanding that we just set the entry to a string, not an object?

Is this not what the policy entry would look like?
pt_->policy_table.app_policies_section.apps[app_id]:

"app_policies": {
  "app_id": "pre_DataConsent"
}

It was my understanding we don't need to set properties on app_policies.app_id as it is a reference to app_policies.pre_DataConsent where the correct heartbeat timeout ms should live.

i see that this change does fix the issue, but really, when an app's section (app_policies_section.apps[app_id]) is a reference (like "app_id": "pre_DataConsent") should the properties like heart_beat_timeout_ms be pulled from the app that the reference points to (in provided case, that would be app_policies_section.apps["pre_DataConsent"])

Copy link
Contributor

Choose a reason for hiding this comment

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

@iCollin in this example we just mark that entry as a reference to preData entity and assign value of preData.heart_beat_timeout_ms to app_id.heart_beat_timeout_ms, however preData is still the initial source of that value. Looks like there was no another place where SDL pulls that value from preData.
When snapshot is generated, this app_id will be properly collapsed into record you mentioned above.

@LitvinenkoIra LitvinenkoIra added the Waiting for Feedback Maintainers are waiting for feedback from an author or contributor label Nov 17, 2020
@AKalinich-Luxoft
Copy link
Contributor

@iCollin regression and verification scripts are PASSED, fix is ready

@dboltovskyi
Copy link
Contributor

@iCollin Please also consider update in scripts smartdevicelink/sdl_atf_test_scripts#2499 which enables related test

@iCollin iCollin merged commit 218aee1 into smartdevicelink:develop Dec 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Waiting for Feedback Maintainers are waiting for feedback from an author or contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants