-
Notifications
You must be signed in to change notification settings - Fork 243
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
Fix applying heart_beat_timeout_ms from PreDataConsent #1551
Conversation
@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); |
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.
@VVeremjova const and probably uint32_t
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.
CACHE_MANAGER_CHECK(0); | ||
uint32_t result = 0; | ||
if (!IsApplicationRepresented(app_id)) { | ||
LOG4CXX_DEBUG(logger_, "App is not represented"); |
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.
@VVeremjova please print there app_id. And probably it is warning? No?
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.
@@ -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) { |
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.
@VVeremjova invert comparator please :
kPreDataConsentId == app_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.
@@ -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] |
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.
@VVeremjova please extract long string to local variable to better read
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.
application_manager_.connection_handler().SetHeartBeatTimeout(app_id, | ||
timeout); | ||
} else { | ||
LOG4CXX_INFO(logger_, "SetHeartBeatTimeout for " << app_id << " ignored"); |
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.
@VVeremjova is it 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.
@@ -479,6 +479,8 @@ class PolicyHandler : public PolicyHandlerInterface, | |||
*/ | |||
void LinkAppsToDevice(); | |||
|
|||
void SetHeartBeatTimeout(const std::string& policy_app_id, uint32_t app_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.
@VVeremjova uint32_t app_id can be const?
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.
@VVeremjova please add @dcherniev @indlu to review |
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.
@VVeremjova, reviewed
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.
@VVeremjova Reviewed.
5400318
to
e0bb7ba
Compare
Can one of the admins verify this patch? |
2 similar comments
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
After sending SDL.OnAllowSDLFunctionality(allowed = false) application is assigned to PreDataConsent group. After this HB timeout is set to timeout from PreDataConsent
e0bb7ba
to
ef93b27
Compare
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.
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 = |
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.
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"]
)
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.
@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.
@iCollin regression and verification scripts are PASSED, fix is ready |
@iCollin Please also consider update in scripts smartdevicelink/sdl_atf_test_scripts#2499 which enables related test |
After sending SDL.OnAllowSDLFunctionality(allowed = false) application is assigned to PreDataConsent group.
After this HB timeout is set to timeout from PreDataConsent