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/examples | |
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/examples')
-rw-r--r-- | src/examples/dlt-example-user.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/examples/dlt-example-user.c b/src/examples/dlt-example-user.c index 61550fc..5822fde 100644 --- a/src/examples/dlt-example-user.c +++ b/src/examples/dlt-example-user.c @@ -102,8 +102,9 @@ void usage() printf(" -k Send marker message\n"); printf(" -m mode Set log mode 0=off,1=external,2=internal,3=both\n"); printf(" -l level Set log level to <level>, level=-1..6\n"); + printf(" -t timeout Set timeout when sending messages at exit, in ms (Default: 10000 = 10sec)\n"); #ifdef DLT_TEST_ENABLE - printf(" -c Corrupt user header\n"); + printf(" -c Corrupt user header\n"); printf(" -s size Corrupt message size\n"); printf(" -z size Size of message\n"); #endif /* DLT_TEST_ENABLE */ @@ -128,6 +129,7 @@ int main(int argc, char* argv[]) char *mvalue = 0; char *message = 0; int lvalue = DLT_LOG_WARN; + char *tvalue = 0; int index; int c; @@ -140,9 +142,9 @@ int main(int argc, char* argv[]) opterr = 0; #ifdef DLT_TEST_ENABLE - while ((c = getopt (argc, argv, "vgakcd:f:n:m:z:s:l:")) != -1) + while ((c = getopt (argc, argv, "vgakcd:f:n:m:z:s:l:t:")) != -1) #else - while ((c = getopt (argc, argv, "vgakd:f:n:m:l:")) != -1) + while ((c = getopt (argc, argv, "vgakd:f:n:m:l:t:")) != -1) #endif /* DLT_TEST_ENABLE */ { switch (c) @@ -204,9 +206,14 @@ int main(int argc, char* argv[]) lvalue = atoi(optarg); break; } + case 't': + { + tvalue = optarg; + break; + } case '?': { - if (optopt == 'd' || optopt == 'f' || optopt == 'n'|| optopt == 'l') + if (optopt == 'd' || optopt == 'f' || optopt == 'n'|| optopt == 'l' || optopt == 't') { fprintf (stderr, "Option -%c requires an argument.\n", optopt); } @@ -306,6 +313,11 @@ int main(int argc, char* argv[]) delay = 500 * 1000; } + if (tvalue) + { + dlt_set_resend_timeout_atexit(atoi(tvalue)); + } + if (gflag) { /* DLT messages to test Fibex non-verbose description: dlt-example-non-verbose.xml */ |