diff options
author | Stefan Vacek <stefan.vacek@intel.com> | 2015-08-31 09:29:07 +0200 |
---|---|---|
committer | Alexander Wenzel <Alexander.AW.Wenzel@bmw.de> | 2015-10-07 10:38:19 +0200 |
commit | 0d330db31f5df337cbb5780a0f6621a7b2cb6396 (patch) | |
tree | 7463ff88ee504cdeaf12f0627c53a05ad2250b70 /src/lib/dlt_user.c | |
parent | ed412acac8e9f8a5745e55adeed9652b34b9ee4f (diff) | |
download | DLT-daemon-0d330db31f5df337cbb5780a0f6621a7b2cb6396.tar.gz |
Make timeout on exit configurable
- make timeout in at_exit handler configurable (was hardcoded to 10s), new api:
int dlt_set_resend_timeout_atexit(uint32_t timeout_in_milliseconds);
- add option -t to dlt-adaptor-stdin to set timeout in at_exit_handler
- add option -t to dlt-example-user to set timeout in at_exit_handler
Signed-off-by: Stefan Vacek <stefan.vacek@intel.com>
Diffstat (limited to 'src/lib/dlt_user.c')
-rw-r--r-- | src/lib/dlt_user.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/lib/dlt_user.c b/src/lib/dlt_user.c index f961bb5..2164768 100644 --- a/src/lib/dlt_user.c +++ b/src/lib/dlt_user.c @@ -465,6 +465,8 @@ int dlt_init_common(void) dlt_user.local_print_mode = DLT_PM_UNSET; + dlt_user.timeout_at_exit_handler = DLT_USER_ATEXIT_RESEND_BUFFER_EXIT_TIMEOUT; + env_local_print = getenv(DLT_USER_ENV_LOCAL_PRINT_MODE); if (env_local_print) { @@ -555,7 +557,7 @@ int dlt_user_atexit_blow_out_user_buffer(void){ int count,ret; - uint32_t exitTime = dlt_uptime() + DLT_USER_ATEXIT_RESEND_BUFFER_EXIT_TIMEOUT; + uint32_t exitTime = dlt_uptime() + dlt_user.timeout_at_exit_handler; /* Send content of ringbuffer */ DLT_SEM_LOCK(); @@ -1202,6 +1204,20 @@ int dlt_set_log_mode(DltUserLogMode mode) return dlt_user_log_send_log_mode(mode); } +int dlt_set_resend_timeout_atexit(uint32_t timeout_in_milliseconds) +{ + if (dlt_user_initialised==0) + { + if (dlt_init()<0) + { + return -1; + } + } + dlt_user.timeout_at_exit_handler = timeout_in_milliseconds * 10; + return 0; +} + + int dlt_forward_msg(void *msgdata,size_t size) { DltUserHeader userheader; |