summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/dlt_user.c49
-rw-r--r--src/lib/dlt_user.c.rej62
-rwxr-xr-xsrc/lib/dlt_user_cfg.h4
-rw-r--r--src/lib/dlt_user_cfg.h.rej16
4 files changed, 118 insertions, 13 deletions
diff --git a/src/lib/dlt_user.c b/src/lib/dlt_user.c
index 2d81a98..95bcf8d 100644
--- a/src/lib/dlt_user.c
+++ b/src/lib/dlt_user.c
@@ -501,21 +501,48 @@ int dlt_user_atexit_blow_out_user_buffer(void){
uint32_t exitTime = dlt_uptime() + DLT_USER_ATEXIT_RESEND_BUFFER_EXIT_TIMEOUT;
- while(dlt_uptime() < exitTime ){
+ /* Send content of ringbuffer */
+ DLT_SEM_LOCK();
+ count = dlt_buffer_get_message_count(&(dlt_user.startup_buffer));
+ DLT_SEM_FREE();
+
+ if (count > 0)
+ {
+ while(dlt_uptime() < exitTime )
+ {
+ if (dlt_user.dlt_log_handle == -1)
+ {
+ /* Reattach to daemon if neccesary */
+ dlt_user_log_reattach_to_daemon();
- ret = dlt_user_log_resend_buffer();
+ if ((dlt_user.dlt_log_handle != -1) && (dlt_user.overflow_counter))
+ {
+ if (dlt_user_log_send_overflow()==0)
+ {
+ snprintf(str,DLT_USER_BUFFER_LENGTH,"%u messages discarded!\n",dlt_user.overflow_counter);
+ dlt_log(LOG_WARNING, str);
+ dlt_user.overflow_counter=0;
+ }
+ }
+ }
+
+ if (dlt_user.dlt_log_handle != -1)
+ {
+ ret = dlt_user_log_resend_buffer();
- if(ret == 0)
- {
- return 0;
- }
+ if(ret == 0)
+ {
+ return 0;
+ }
+ }
- usleep(DLT_USER_ATEXIT_RESEND_BUFFER_SLEEP);
- }
+ usleep(DLT_USER_ATEXIT_RESEND_BUFFER_SLEEP);
+ }
- DLT_SEM_LOCK();
- count = dlt_buffer_get_message_count(&(dlt_user.startup_buffer));
- DLT_SEM_FREE();
+ DLT_SEM_LOCK();
+ count = dlt_buffer_get_message_count(&(dlt_user.startup_buffer));
+ DLT_SEM_FREE();
+ }
return count;
}
diff --git a/src/lib/dlt_user.c.rej b/src/lib/dlt_user.c.rej
new file mode 100644
index 0000000..c197d0d
--- /dev/null
+++ b/src/lib/dlt_user.c.rej
@@ -0,0 +1,62 @@
+--- src/lib/dlt_user.c
++++ src/lib/dlt_user.c
+@@ -501,48 +501,21 @@ int dlt_user_atexit_blow_out_user_buffer(void){
+
+ uint32_t exitTime = dlt_uptime() + DLT_USER_ATEXIT_RESEND_BUFFER_EXIT_TIMEOUT;
+
+- /* Send content of ringbuffer */
+- DLT_SEM_LOCK();
+- count = dlt_buffer_get_message_count(&(dlt_user.startup_buffer));
+- DLT_SEM_FREE();
+-
+- if (count > 0)
+- {
+- while(dlt_uptime() < exitTime )
+- {
+- if (dlt_user.dlt_log_handle == -1)
+- {
+- /* Reattach to daemon if neccesary */
+- dlt_user_log_reattach_to_daemon();
++ while(dlt_uptime() < exitTime ){
+
+- if ((dlt_user.dlt_log_handle != -1) && (dlt_user.overflow_counter))
+- {
+- if (dlt_user_log_send_overflow()==0)
+- {
+- snprintf(str,DLT_USER_BUFFER_LENGTH,"%u messages discarded!\n",dlt_user.overflow_counter);
+- dlt_log(LOG_WARNING, str);
+- dlt_user.overflow_counter=0;
+- }
+- }
+- }
+-
+- if (dlt_user.dlt_log_handle != -1)
+- {
+- ret = dlt_user_log_resend_buffer();
++ ret = dlt_user_log_resend_buffer();
+
+- if(ret == 0)
+- {
+- return 0;
+- }
+- }
++ if(ret == 0)
++ {
++ return 0;
++ }
+
+- usleep(DLT_USER_ATEXIT_RESEND_BUFFER_SLEEP);
+- }
++ usleep(DLT_USER_ATEXIT_RESEND_BUFFER_SLEEP);
++ }
+
+- DLT_SEM_LOCK();
+- count = dlt_buffer_get_message_count(&(dlt_user.startup_buffer));
+- DLT_SEM_FREE();
+- }
++ DLT_SEM_LOCK();
++ count = dlt_buffer_get_message_count(&(dlt_user.startup_buffer));
++ DLT_SEM_FREE();
+
+ return count;
+ }
diff --git a/src/lib/dlt_user_cfg.h b/src/lib/dlt_user_cfg.h
index 9559c98..3355714 100755
--- a/src/lib/dlt_user_cfg.h
+++ b/src/lib/dlt_user_cfg.h
@@ -126,11 +126,11 @@
/* Name of environment variable for local print mode */
#define DLT_USER_ENV_LOCAL_PRINT_MODE "DLT_LOCAL_PRINT_MODE"
-/* Timeout offset for resending user buffer at exit in usec (1000 usec = 1ms)*/
+/* Timeout offset for resending user buffer at exit in 10th milliseconds (10000 = 1s)*/
#define DLT_USER_ATEXIT_RESEND_BUFFER_EXIT_TIMEOUT 100000
/* Sleeps between resending user buffer at exit in usec (1000 usec = 1ms)*/
-#define DLT_USER_ATEXIT_RESEND_BUFFER_SLEEP 1000
+#define DLT_USER_ATEXIT_RESEND_BUFFER_SLEEP 100000
/************************/
diff --git a/src/lib/dlt_user_cfg.h.rej b/src/lib/dlt_user_cfg.h.rej
new file mode 100644
index 0000000..a722e78
--- /dev/null
+++ b/src/lib/dlt_user_cfg.h.rej
@@ -0,0 +1,16 @@
+--- src/lib/dlt_user_cfg.h
++++ src/lib/dlt_user_cfg.h
+@@ -126,11 +126,11 @@
+ /* Name of environment variable for local print mode */
+ #define DLT_USER_ENV_LOCAL_PRINT_MODE "DLT_LOCAL_PRINT_MODE"
+
+-/* Timeout offset for resending user buffer at exit in 10th milliseconds (10000 = 1s)*/
++/* Timeout offset for resending user buffer at exit in usec (1000 usec = 1ms)*/
+ #define DLT_USER_ATEXIT_RESEND_BUFFER_EXIT_TIMEOUT 100000
+
+ /* Sleeps between resending user buffer at exit in usec (1000 usec = 1ms)*/
+-#define DLT_USER_ATEXIT_RESEND_BUFFER_SLEEP 100000
++#define DLT_USER_ATEXIT_RESEND_BUFFER_SLEEP 1000
+
+
+ /************************/