From 636310aa3bf09c23d73f43e2e50a923bd34320e5 Mon Sep 17 00:00:00 2001 From: YoungHun Kim Date: Thu, 25 May 2017 16:08:16 +0900 Subject: [PATCH] Update to set dispatcher of disable watchdog using mused.conf Change-Id: I3c3ea91e895ee2c44cfb3f68580c8551a4baede3 --- include/muse_core_config.h | 2 ++ src/muse_core.c | 3 +-- src/muse_core_config.c | 6 ++++++ src/muse_core_module.c | 6 ++---- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/muse_core_config.h b/include/muse_core_config.h index 76ccea3..3f2b4cf 100644 --- a/include/muse_core_config.h +++ b/include/muse_core_config.h @@ -42,11 +42,13 @@ extern "C" { #define PATH "path" #define PRELOADED "preloaded" #define TIMEOUT "timeout" +#define DIABLEWATCHDOGAPI "disable_watchdog_api" typedef struct host_info { char *path; char *preloaded; int timeout; + int disable_watchdog_api; } host_info_t; typedef struct muse_core_config { diff --git a/src/muse_core.c b/src/muse_core.c index 9fb618f..3c862e8 100644 --- a/src/muse_core.c +++ b/src/muse_core.c @@ -445,10 +445,9 @@ static void _muse_core_write_info(char *cmd) static void _muse_core_check_memory(pid_t pid) { - int used_pss_mb; + int used_pss_mb = muse_core_system_get_instance()->get_memory_info(pid); if (g_queue_is_empty(muse_core_ipc_get_instance()->module_queue)) { - used_pss_mb = muse_core_system_get_instance()->get_memory_info(pid); if (used_pss_mb > muse_core_config_get_instance()->memory_threshold) { LOGE("[Memory Leak] %d > %d", used_pss_mb, muse_core_config_get_instance()->memory_threshold); muse_core_log_process_info(pid); diff --git a/src/muse_core_config.c b/src/muse_core_config.c index e289a6f..82468d9 100644 --- a/src/muse_core_config.c +++ b/src/muse_core_config.c @@ -196,6 +196,12 @@ static int _muse_core_config_parser(void) goto out; } + /* disable_watchdog_api */ + snprintf(host_name, MUSE_MAX_MSG_LEN, "%s%s%s", host, COLON, DIABLEWATCHDOGAPI); + + g_muse_core_conf->host_infos[host_cnt]->disable_watchdog_api = + atoi(iniparser_getstring(g_muse_core_conf->muse_dict, host_name, NULL)); + host = strtok_r(NULL, COMMA, &ptr); g_muse_core_conf->host_cnt++; MUSE_FREE(host_name); diff --git a/src/muse_core_module.c b/src/muse_core_module.c index 2454b87..f96f370 100644 --- a/src/muse_core_module.c +++ b/src/muse_core_module.c @@ -91,10 +91,8 @@ static gboolean _muse_core_module_dispatch_callback(gpointer data) static gboolean _muse_core_module_enable_dispatch_callback(int cmd, muse_module_h module) { - if (module->api_module == MUSE_CAMERA || module->api_module == MUSE_RECORDER) { - if (cmd == API_CREATE) - return FALSE; - } + if (cmd == muse_core_config_get_instance()->host_infos[module->api_module]->disable_watchdog_api) + return FALSE; return TRUE; } -- 2.7.4