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/adaptor | |
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/adaptor')
-rw-r--r-- | src/adaptor/dlt-adaptor-stdin.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/adaptor/dlt-adaptor-stdin.c b/src/adaptor/dlt-adaptor-stdin.c index 2ad0ca5..33ab8a2 100644 --- a/src/adaptor/dlt-adaptor-stdin.c +++ b/src/adaptor/dlt-adaptor-stdin.c @@ -90,11 +90,12 @@ int main(int argc, char* argv[]) char apid[DLT_ID_SIZE]; char ctid[DLT_ID_SIZE]; char version[255]; + int timeout = -1; dlt_set_id(apid, PS_DLT_APP); dlt_set_id(ctid, PS_DLT_CONTEXT); - while ((opt = getopt(argc, argv, "a:c:h")) != -1) + while ((opt = getopt(argc, argv, "a:c:ht:")) != -1) { switch (opt) { @@ -108,6 +109,11 @@ int main(int argc, char* argv[]) dlt_set_id(ctid,optarg); break; } + case 't': + { + timeout = atoi(optarg); + break; + } case 'h': { dlt_get_version(version,255); @@ -116,9 +122,10 @@ int main(int argc, char* argv[]) printf("Adaptor for forwarding input from stdin to DLT daemon.\n"); printf("%s \n", version); printf("Options:\n"); - printf("-a apid - Set application id to apid (default: SINA)\n"); - printf("-c ctid - Set context id to ctid (default: SINC)\n"); - printf("-h - This help\n"); + printf(" -a apid - Set application id to apid (default: SINA)\n"); + printf(" -c ctid - Set context id to ctid (default: SINC)\n"); + printf(" -t timeout - Set timeout when sending messages at exit, in ms (Default: 10000 = 10sec)\n"); + printf(" -h - This help\n"); return 0; break; } @@ -132,6 +139,10 @@ int main(int argc, char* argv[]) DLT_REGISTER_APP(apid,PS_DLT_APP_DESC); DLT_REGISTER_CONTEXT(mycontext, ctid, PS_DLT_CONTEXT_DESC); + if (timeout > -1) + { + dlt_set_resend_timeout_atexit(timeout); + } while (fgets(str, MAXSTRLEN, stdin)) { |