Update DML if HAL params change when applying#1133
Conversation
a4da566 to
9641ce3
Compare
| return TIMER_TASK_COMPLETE; | ||
| } | ||
|
|
||
| int update_global_cache(wifi_vap_info_map_t *tgt_vap_map, rdk_wifi_vap_info_t *rdk_vap_info) |
There was a problem hiding this comment.
Since it's being used in other translation units add declaration to one of the headers and include in each translation unit that uses it outside of this one.
| webconfig_subdoc_data_t *dml_cache_update_subdoc = (webconfig_subdoc_data_t *)malloc( | ||
| sizeof(webconfig_subdoc_data_t)); | ||
|
|
||
| if (dml_cache_update_subdoc == NULL) { | ||
| wifi_util_error_print(WIFI_CTRL, | ||
| "%s:%d: malloc failed to allocate webconfig_subdoc_data_t, size %d\n", __func__, | ||
| __LINE__, sizeof(webconfig_subdoc_data_t)); | ||
| return -1; | ||
| } |
There was a problem hiding this comment.
Allocate memory right before it's used, not here.
| webconfig_subdoc_data_t *dml_cache_update_subdoc = (webconfig_subdoc_data_t *)malloc( | |
| sizeof(webconfig_subdoc_data_t)); | |
| if (dml_cache_update_subdoc == NULL) { | |
| wifi_util_error_print(WIFI_CTRL, | |
| "%s:%d: malloc failed to allocate webconfig_subdoc_data_t, size %d\n", __func__, | |
| __LINE__, sizeof(webconfig_subdoc_data_t)); | |
| return -1; | |
| } | |
| webconfig_subdoc_data_t *dml_cache_update_subdoc = NULL; |
And remove all those free(dml_cache_update_subdoc); that follow.
| wifi_vap_info_map_t *tmp_vap_map = NULL; | ||
| bool dml_cache_update_needed = false; | ||
|
|
||
| webconfig_subdoc_data_t *dml_cache_update_subdoc = (webconfig_subdoc_data_t *)malloc( |
There was a problem hiding this comment.
Same as before - don't allocate memory, until it's being used.
| char update_status[128]; | ||
| bool dml_cache_update_needed = false; | ||
|
|
||
| webconfig_subdoc_data_t *dml_cache_update_subdoc = (webconfig_subdoc_data_t *)malloc( |
There was a problem hiding this comment.
Same as before - don't allocate memory, until it's being used.
| char update_status[128], old_sec_mode[32], new_sec_mode[32]; | ||
| bool dml_cache_update_needed = false; | ||
|
|
||
| webconfig_subdoc_data_t *dml_cache_update_subdoc = (webconfig_subdoc_data_t *)malloc( |
There was a problem hiding this comment.
Same as before - don't allocate memory, until it's being used.
| int ret = 0; | ||
|
|
||
| bool dml_cache_update_needed = false; | ||
| webconfig_subdoc_data_t *dml_cache_update_subdoc = (webconfig_subdoc_data_t *)malloc( |
There was a problem hiding this comment.
Same as before - don't allocate memory, until it's being used.
| if (dml_cache_update_needed) { | ||
| wifi_ctrl_t *ctrl = (wifi_ctrl_t *)get_wifictrl_obj(); | ||
| ctrl->webconfig_state |= ctrl_webconfig_state_vap_all_cfg_rsp_pending; | ||
| if (webconfig_encode(&ctrl->webconfig, dml_cache_update_subdoc, | ||
| webconfig_subdoc_type_dml) == webconfig_error_none) { | ||
| wifi_util_info_print(WIFI_CTRL, "%s:%d webconfig_encode success\n", __FUNCTION__, | ||
| __LINE__); | ||
| } else { | ||
| wifi_util_error_print(WIFI_CTRL, "%s:%d webconfig_encode failed\n", __FUNCTION__, | ||
| __LINE__); | ||
| } | ||
| } |
There was a problem hiding this comment.
I saw these chunks of code are repeating. I think you can move them into separate function and call that function instead.
Using WebConfig we are synchronizing the current manager cache with DML cache if params that were passed down to createVAP() change after the function finalizes.
9641ce3 to
d0fcfd4
Compare
Using WebConfig we are synchronizing the current manager cache with DML cache if params that were passed down to createVAP() change after the funcion finalizes.