summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBui Nguyen Quoc Thanh <thanh.buinguyenquoc@vn.bosch.com>2020-10-26 16:28:00 +0700
committerSaya Sugiura <39760799+ssugiura@users.noreply.github.com>2021-01-06 09:27:28 +0900
commit4eb5be749b23081d2c92680d2a481e36f7ac0685 (patch)
treeee8a41dd31baa4136e1685082c598f41f0bef2c1
parent1bbccc2bb07109007fecaf8007a6552d056edb66 (diff)
downloadDLT-daemon-4eb5be749b23081d2c92680d2a481e36f7ac0685.tar.gz
daemon: Correct order of runtime config load.
Since order of runtime config load for app-ctx and dlt-runtime are different from each other, so they could not be in the same load_runtime function. Signed-off-by: Bui Nguyen Quoc Thanh <thanh.buinguyenquoc@vn.bosch.com>
-rw-r--r--src/daemon/dlt-daemon.c18
-rw-r--r--src/daemon/dlt_daemon_common.c11
-rw-r--r--src/daemon/dlt_daemon_common.h7
3 files changed, 24 insertions, 12 deletions
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c
index 64135bd..775d3a9 100644
--- a/src/daemon/dlt-daemon.c
+++ b/src/daemon/dlt-daemon.c
@@ -952,7 +952,7 @@ int main(int argc, char *argv[])
/* --- Daemon connection init end */
- if (dlt_daemon_load_runtime_configuration(&daemon, daemon_local.flags.ivalue, daemon_local.flags.vflag) == -1) {
+ if (dlt_daemon_init_runtime_configuration(&daemon, daemon_local.flags.ivalue, daemon_local.flags.vflag) == -1) {
dlt_log(LOG_ERR, "Could not load runtime config\n");
return -1;
}
@@ -965,6 +965,12 @@ int main(int argc, char *argv[])
/* --- Daemon init phase 2 end --- */
+ /*
+ * Load dlt-runtime.cfg if available.
+ * This must be loaded before offline setup
+ */
+ dlt_daemon_configuration_load(&daemon, daemon.runtime_configuration, daemon_local.flags.vflag);
+
if (daemon_local.flags.offlineLogstorageDirPath[0])
if (dlt_daemon_logstorage_setup_internal_storage(
&daemon,
@@ -1028,6 +1034,16 @@ int main(int argc, char *argv[])
daemon_local.flags.gatewayMode,
daemon_local.flags.vflag);
+ /*
+ * Check for app and ctx runtime cfg.
+ * These cfg must be loaded after ecuId and num_user_lists are available
+ */
+ if ((dlt_daemon_applications_load(&daemon, daemon.runtime_application_cfg,
+ daemon_local.flags.vflag) == 0) &&
+ (dlt_daemon_contexts_load(&daemon, daemon.runtime_context_cfg,
+ daemon_local.flags.vflag) == 0))
+ daemon.runtime_context_cfg_loaded = 1;
+
dlt_daemon_log_internal(&daemon,
&daemon_local,
"Daemon launched. Starting to output traces...",
diff --git a/src/daemon/dlt_daemon_common.c b/src/daemon/dlt_daemon_common.c
index 4349753..cff1a9e 100644
--- a/src/daemon/dlt_daemon_common.c
+++ b/src/daemon/dlt_daemon_common.c
@@ -140,8 +140,9 @@ DltDaemonRegisteredUsers *dlt_daemon_find_users_list(DltDaemon *daemon,
dlt_vlog(LOG_ERR, "Cannot find user list for ECU: %4s\n", ecu);
return (DltDaemonRegisteredUsers *)NULL;
}
-int dlt_daemon_load_runtime_configuration(DltDaemon *daemon, const char *runtime_directory, int verbose)
+int dlt_daemon_init_runtime_configuration(DltDaemon *daemon, const char *runtime_directory, int verbose)
{
+ PRINT_FUNCTION_VERBOSE(verbose);
int append_length = 0;
if (daemon == NULL)
@@ -193,14 +194,6 @@ int dlt_daemon_load_runtime_configuration(DltDaemon *daemon, const char *runtime
strcat(daemon->runtime_configuration, DLT_RUNTIME_CONFIGURATION); /* strcat uncritical here, because max length already checked */
- /* Check for runtime cfg, if it is loadable, load it! */
- if ((dlt_daemon_applications_load(daemon, daemon->runtime_application_cfg, verbose) == 0) &&
- (dlt_daemon_contexts_load(daemon, daemon->runtime_context_cfg, verbose) == 0))
- daemon->runtime_context_cfg_loaded = 1;
-
- /* load configuration if available */
- dlt_daemon_configuration_load(daemon, daemon->runtime_configuration, verbose);
-
return DLT_RETURN_OK;
}
diff --git a/src/daemon/dlt_daemon_common.h b/src/daemon/dlt_daemon_common.h
index c6a4594..8586e1b 100644
--- a/src/daemon/dlt_daemon_common.h
+++ b/src/daemon/dlt_daemon_common.h
@@ -246,13 +246,16 @@ DltDaemonRegisteredUsers *dlt_daemon_find_users_list(DltDaemon *daemon,
char *ecu,
int verbose);
/**
- * Loads the user saved configurations to daemon
+ * Init the user saved configurations to daemon.
+ * Since the order of loading runtime config could be different,
+ * this function won't be the place to do that.
+ * This is just for preparation of real load later.
* @param daemon pointer to dlt daemon structure
* @param runtime_directory directory path
* @param verbose if set to true verbose information is printed out
* @return DLT_RETURN_OK on success, DLT_RETURN_ERROR otherwise
*/
-int dlt_daemon_load_runtime_configuration(DltDaemon *daemon,
+int dlt_daemon_init_runtime_configuration(DltDaemon *daemon,
const char *runtime_directory,
int verbose);