summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xinclude/dlt/dlt_common.h1
-rw-r--r--include/dlt/dlt_user.h1
-rw-r--r--src/daemon/dlt-daemon.c80
-rwxr-xr-xsrc/daemon/dlt-daemon.h1
-rw-r--r--src/daemon/dlt_daemon_common.c37
-rw-r--r--src/daemon/dlt_daemon_common.h7
-rw-r--r--src/lib/dlt_user.c76
-rwxr-xr-xsrc/shared/dlt_common.c2
-rwxr-xr-xsrc/shared/dlt_user_shared.h9
9 files changed, 172 insertions, 42 deletions
diff --git a/include/dlt/dlt_common.h b/include/dlt/dlt_common.h
index 4fb9cff..b0b62eb 100755
--- a/include/dlt/dlt_common.h
+++ b/include/dlt/dlt_common.h
@@ -478,6 +478,7 @@ typedef struct
uint32_t service_id; /**< service ID */
uint8_t status; /**< reponse status */
uint8_t overflow; /**< overflow status */
+ uint32_t overflow_counter; /**< overflow counter */
} PACKED DltServiceMessageBufferOverflowResponse;
typedef struct
diff --git a/include/dlt/dlt_user.h b/include/dlt/dlt_user.h
index b548707..1317112 100644
--- a/include/dlt/dlt_user.h
+++ b/include/dlt/dlt_user.h
@@ -218,6 +218,7 @@ typedef struct
uint32_t dlt_ll_ts_num_entries; /**< Number of used contexts */
int8_t overflow; /**< Overflow marker, set to 1 on overflow, 0 otherwise */
+ uint32_t overflow_counter; /**< Counts the number of lost messages */
char *application_description; /**< description of application */
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c
index 64a8acd..a44d028 100644
--- a/src/daemon/dlt-daemon.c
+++ b/src/daemon/dlt-daemon.c
@@ -1522,6 +1522,7 @@ int dlt_daemon_process_user_messages(DltDaemon *daemon, DltDaemonLocal *daemon_l
int dlt_daemon_process_user_message_overflow(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose)
{
int j, sent;
+ DltUserControlMsgBufferOverflow *userpayload;
PRINT_FUNCTION_VERBOSE(verbose);
@@ -1531,6 +1532,15 @@ int dlt_daemon_process_user_message_overflow(DltDaemon *daemon, DltDaemonLocal *
return -1;
}
+ if (daemon_local->receiver.bytesRcvd < (int32_t)(sizeof(DltUserHeader)+sizeof(DltUserControlMsgBufferOverflow)))
+ {
+ /* Not enough bytes received */
+ return -1;
+ }
+
+ /* get the payload of the user message */
+ userpayload = (DltUserControlMsgBufferOverflow*) (daemon_local->receiver.buf+sizeof(DltUserHeader));
+
/* Store in daemon, that a message buffer overflow has occured */
daemon->message_buffer_overflow = DLT_MESSAGE_BUFFER_OVERFLOW;
@@ -1545,7 +1555,7 @@ int dlt_daemon_process_user_message_overflow(DltDaemon *daemon, DltDaemonLocal *
/* except the listener and ourselves */
if ((j != daemon_local->fp) && (j != daemon_local->sock))
{
- dlt_daemon_control_message_buffer_overflow(j, daemon, verbose);
+ dlt_daemon_control_message_buffer_overflow(j, daemon, userpayload->overflow_counter,userpayload->apid,verbose);
sent=1;
/* Reset overflow state */
daemon->message_buffer_overflow = DLT_MESSAGE_BUFFER_NO_OVERFLOW;
@@ -1556,11 +1566,17 @@ int dlt_daemon_process_user_message_overflow(DltDaemon *daemon, DltDaemonLocal *
/* message was not sent, so store it in ringbuffer */
if (sent==0)
{
- dlt_daemon_control_message_buffer_overflow(DLT_DAEMON_STORE_TO_BUFFER, daemon, verbose);
+ if(dlt_daemon_control_message_buffer_overflow(DLT_DAEMON_STORE_TO_BUFFER, daemon, userpayload->overflow_counter,
+ userpayload->apid,verbose))
+ {
+ /* there was an error when storing message */
+ /* add the counter of lost messages to the daemon counter */
+ daemon->overflow_counter+=userpayload->overflow_counter;
+ }
}
/* keep not read data in buffer */
- if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader))==-1)
+ if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgBufferOverflow))==-1)
{
dlt_log(LOG_ERR,"Can't remove bytes from receiver for user message overflow\n");
return -1;
@@ -1569,6 +1585,49 @@ int dlt_daemon_process_user_message_overflow(DltDaemon *daemon, DltDaemonLocal *
return 0;
}
+int dlt_daemon_send_message_overflow(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose)
+{
+ int j, sent;
+
+ PRINT_FUNCTION_VERBOSE(verbose);
+
+ if ((daemon==0) || (daemon_local==0))
+ {
+ dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_user_message_overflow()\n");
+ return -1;
+ }
+
+ /* Store in daemon, that a message buffer overflow has occured */
+ daemon->message_buffer_overflow = DLT_MESSAGE_BUFFER_OVERFLOW;
+
+ /* look if TCP connection to client is available */
+ sent = 0;
+
+ for (j = 0; j <= daemon_local->fdmax; j++)
+ {
+ /* send to everyone! */
+ if (FD_ISSET(j, &(daemon_local->master)))
+ {
+ /* except the listener and ourselves */
+ if ((j != daemon_local->fp) && (j != daemon_local->sock))
+ {
+ dlt_daemon_control_message_buffer_overflow(j, daemon,daemon->overflow_counter,"", verbose);
+ sent=1;
+ /* Reset overflow state */
+ daemon->message_buffer_overflow = DLT_MESSAGE_BUFFER_NO_OVERFLOW;
+ } /* if */
+ } /* if */
+ } /* for */
+
+ /* message was not sent, so store it in ringbuffer */
+ if (sent==0)
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
int dlt_daemon_process_user_message_register_application(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose)
{
uint32_t len=0;
@@ -2004,6 +2063,17 @@ int dlt_daemon_process_user_message_log(DltDaemon *daemon, DltDaemonLocal *daemo
sent = 1;
}
+ /* check if overflow occurred */
+ if(daemon->overflow_counter)
+ {
+ if(dlt_daemon_send_message_overflow(daemon,daemon_local,verbose)==0)
+ {
+ sprintf(str,"%u messages discarded!\n",daemon->overflow_counter);
+ dlt_log(LOG_ERR, str);
+ daemon->overflow_counter=0;
+ }
+ }
+
/* look if TCP connection to client is available */
for (j = 0;((daemon->mode == DLT_USER_MODE_EXTERNAL) || (daemon->mode == DLT_USER_MODE_BOTH)) && (j <= daemon_local->fdmax); j++)
{
@@ -2080,7 +2150,9 @@ int dlt_daemon_process_user_message_log(DltDaemon *daemon, DltDaemonLocal *daemo
0, 0
)<0)
{
- dlt_log(LOG_ERR,"Storage of message in history buffer failed! Message discarded.\n");
+ if(daemon->overflow_counter==0)
+ dlt_log(LOG_ERR,"Buffer full! Messages will be discarded.\n");
+ daemon->overflow_counter+=1;
}
DLT_DAEMON_SEM_FREE();
}
diff --git a/src/daemon/dlt-daemon.h b/src/daemon/dlt-daemon.h
index b256cc3..f2b1dd9 100755
--- a/src/daemon/dlt-daemon.h
+++ b/src/daemon/dlt-daemon.h
@@ -166,6 +166,7 @@ int dlt_daemon_process_client_messages_serial(DltDaemon *daemon, DltDaemonLocal
int dlt_daemon_process_user_messages(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
int dlt_daemon_process_user_message_overflow(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
+int dlt_daemon_send_message_overflow(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
int dlt_daemon_process_user_message_register_application(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
int dlt_daemon_process_user_message_unregister_application(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
int dlt_daemon_process_user_message_register_context(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
diff --git a/src/daemon/dlt_daemon_common.c b/src/daemon/dlt_daemon_common.c
index afedff9..b817ce9 100644
--- a/src/daemon/dlt_daemon_common.c
+++ b/src/daemon/dlt_daemon_common.c
@@ -136,6 +136,7 @@ int dlt_daemon_init(DltDaemon *daemon,const char *runtime_directory, int verbose
daemon->default_trace_status = DLT_DAEMON_INITIAL_TRACE_STATUS ;
daemon->message_buffer_overflow = DLT_MESSAGE_BUFFER_NO_OVERFLOW;
+ daemon->overflow_counter = 0;
daemon->runtime_context_cfg_loaded = 0;
@@ -1266,7 +1267,7 @@ int dlt_daemon_control_process_control(int sock, DltDaemon *daemon, DltMessage *
}
case DLT_SERVICE_ID_MESSAGE_BUFFER_OVERFLOW:
{
- dlt_daemon_control_message_buffer_overflow(sock, daemon, verbose);
+ dlt_daemon_control_message_buffer_overflow(sock, daemon, daemon->overflow_counter,"",verbose);
break;
}
default:
@@ -2075,7 +2076,7 @@ void dlt_daemon_control_get_log_info(int sock, DltDaemon *daemon, DltMessage *ms
dlt_message_free(&resp,0);
}
-void dlt_daemon_control_message_buffer_overflow(int sock, DltDaemon *daemon, int verbose)
+int dlt_daemon_control_message_buffer_overflow(int sock, DltDaemon *daemon, unsigned int overflow_counter,char* apid, int verbose)
{
DltMessage msg;
DltServiceMessageBufferOverflowResponse *resp;
@@ -2084,14 +2085,14 @@ void dlt_daemon_control_message_buffer_overflow(int sock, DltDaemon *daemon, int
if (daemon==0)
{
- return;
+ return -1;
}
/* initialise new message */
if (dlt_message_init(&msg,0)==-1)
{
dlt_daemon_control_service_response(sock, daemon, DLT_SERVICE_ID_MESSAGE_BUFFER_OVERFLOW, DLT_SERVICE_RESPONSE_ERROR, verbose);
- return;
+ return -1;
}
/* prepare payload of data */
@@ -2111,19 +2112,26 @@ void dlt_daemon_control_message_buffer_overflow(int sock, DltDaemon *daemon, int
{
dlt_daemon_control_service_response(sock, daemon, DLT_SERVICE_ID_MESSAGE_BUFFER_OVERFLOW, DLT_SERVICE_RESPONSE_ERROR, verbose);
}
- return;
+ return -1;
}
resp = (DltServiceMessageBufferOverflowResponse*) msg.databuffer;
resp->service_id = DLT_SERVICE_ID_MESSAGE_BUFFER_OVERFLOW;
resp->status = DLT_SERVICE_RESPONSE_OK;
resp->overflow = daemon->message_buffer_overflow;
+ resp->overflow_counter = overflow_counter;
/* send message */
- dlt_daemon_control_send_control_message(sock,daemon,&msg,"","", verbose);
+ if(dlt_daemon_control_send_control_message(sock,daemon,&msg,apid,"", verbose))
+ {
+ dlt_message_free(&msg,0);
+ return -1;
+ }
/* free message */
dlt_message_free(&msg,0);
+
+ return 0;
}
void dlt_daemon_control_service_response( int sock, DltDaemon *daemon, uint32_t service_id, int8_t status , int verbose)
@@ -2171,7 +2179,7 @@ void dlt_daemon_control_service_response( int sock, DltDaemon *daemon, uint32_t
dlt_message_free(&msg,0);
}
-void dlt_daemon_control_send_control_message( int sock, DltDaemon *daemon, DltMessage *msg, char* appid, char* ctid, int verbose)
+int dlt_daemon_control_send_control_message( int sock, DltDaemon *daemon, DltMessage *msg, char* appid, char* ctid, int verbose)
{
ssize_t ret;
int32_t len;
@@ -2180,7 +2188,7 @@ void dlt_daemon_control_send_control_message( int sock, DltDaemon *daemon, DltMe
if ((daemon==0) || (msg==0) || (appid==0) || (ctid==0))
{
- return;
+ return -1;
}
/* prepare storage header */
@@ -2188,7 +2196,7 @@ void dlt_daemon_control_send_control_message( int sock, DltDaemon *daemon, DltMe
if (dlt_set_storageheader(msg->storageheader,daemon->ecuid)==-1)
{
- return;
+ return -1;
}
/* prepare standard header */
@@ -2239,7 +2247,7 @@ void dlt_daemon_control_send_control_message( int sock, DltDaemon *daemon, DltMe
if (len>UINT16_MAX)
{
dlt_log(LOG_CRIT,"Huge control message discarded!\n");
- return;
+ return -1;
}
msg->standardheader->len = DLT_HTOBE_16(((uint16_t)len));
@@ -2259,7 +2267,7 @@ void dlt_daemon_control_send_control_message( int sock, DltDaemon *daemon, DltMe
{
dlt_log(LOG_CRIT,"dlt_daemon_control_send_control_message: write dltSerialHeader failed\n");
DLT_DAEMON_SEM_FREE();
- return;
+ return -1;
}
}
@@ -2269,14 +2277,14 @@ void dlt_daemon_control_send_control_message( int sock, DltDaemon *daemon, DltMe
{
dlt_log(LOG_CRIT,"dlt_daemon_control_send_control_message: write msg->headerbuffer failed\n");
DLT_DAEMON_SEM_FREE();
- return;
+ return -1;
}
ret=write(sock, msg->databuffer,msg->datasize);
if (0 > ret)
{
dlt_log(LOG_CRIT,"dlt_daemon_control_send_control_message: write msg->databuffer failed\n");
DLT_DAEMON_SEM_FREE();
- return;
+ return -1;
}
DLT_DAEMON_SEM_FREE();
@@ -2316,10 +2324,11 @@ void dlt_daemon_control_send_control_message( int sock, DltDaemon *daemon, DltMe
{
DLT_DAEMON_SEM_FREE();
dlt_log(LOG_ERR,"Storage of message in history buffer failed! Message discarded.\n");
- return;
+ return -1;
}
DLT_DAEMON_SEM_FREE();
}
+ return 0;
}
void dlt_daemon_control_reset_to_factory_default(DltDaemon *daemon,const char *filename, const char *filename1, int verbose)
diff --git a/src/daemon/dlt_daemon_common.h b/src/daemon/dlt_daemon_common.h
index 2798491..b93f0c2 100644
--- a/src/daemon/dlt_daemon_common.h
+++ b/src/daemon/dlt_daemon_common.h
@@ -133,6 +133,7 @@ typedef struct
int8_t default_log_level; /**< Default log level (of daemon) */
int8_t default_trace_status; /**< Default trace status (of daemon) */
int message_buffer_overflow; /**< Set to one, if buffer overflow has occured, zero otherwise */
+ unsigned int overflow_counter; /**< counts the number of lost messages. */
int runtime_context_cfg_loaded; /**< Set to one, if runtime context configuration has been loaded, zero otherwise */
char ecuid[DLT_ID_SIZE]; /**< ECU ID of daemon */
int sendserialheader; /**< 1: send serial header; 0 don't send serial header */
@@ -360,8 +361,9 @@ void dlt_daemon_control_service_response(int sock, DltDaemon *daemon, uint32_t s
* @param appid pointer to application id to be used in response message
* @param contid pointer to context id to be used in response message
* @param verbose if set to true verbose information is printed out.
+ * @return -1 if there is an error or buffer is full
*/
-void dlt_daemon_control_send_control_message(int sock, DltDaemon *daemon, DltMessage *msg, char* appid, char* contid, int verbose);
+int dlt_daemon_control_send_control_message(int sock, DltDaemon *daemon, DltMessage *msg, char* appid, char* contid, int verbose);
/**
* Process and generate response to received sw injection control message
@@ -438,8 +440,9 @@ void dlt_daemon_control_get_log_info(int sock, DltDaemon *daemon, DltMessage *ms
* @param sock connection handle used for sending response
* @param daemon pointer to dlt daemon structure
* @param verbose if set to true verbose information is printed out.
+ * @return -1 if there is an error or buffer overflow, else 0
*/
-void dlt_daemon_control_message_buffer_overflow(int sock, DltDaemon *daemon, int verbose);
+int dlt_daemon_control_message_buffer_overflow(int sock, DltDaemon *daemon, unsigned int overflow_counter,char* apid, int verbose);
/**
* Process reset to factory default control message
* @param daemon pointer to dlt daemon structure
diff --git a/src/lib/dlt_user.c b/src/lib/dlt_user.c
index 1f43801..7482948 100644
--- a/src/lib/dlt_user.c
+++ b/src/lib/dlt_user.c
@@ -171,6 +171,7 @@ int dlt_init(void)
dlt_user.dlt_is_file = 0;
dlt_user.overflow = 0;
+ dlt_user.overflow_counter = 0;
#ifdef DLT_SHM_ENABLE
memset(&(dlt_user.dlt_shm),0,sizeof(DltShm));
#endif
@@ -1085,12 +1086,13 @@ int dlt_forward_msg(void *msgdata,size_t size)
/* Reattach to daemon if neccesary */
dlt_user_log_reattach_to_daemon();
- if (dlt_user.overflow)
+ if (dlt_user.overflow_counter)
{
if (dlt_user_log_send_overflow()==0)
{
- dlt_user.overflow=0;
- }
+ sprintf(str,"Buffer full! %u messages discarded!\n",dlt_user.overflow_counter);
+ dlt_log(LOG_ERR, str);
+ dlt_user.overflow_counter=0; }
}
/* log to FIFO */
@@ -1107,14 +1109,17 @@ int dlt_forward_msg(void *msgdata,size_t size)
(unsigned char *)&(userheader), sizeof(DltUserHeader),
msgdata, size, 0, 0)==-1)
{
- dlt_log(LOG_ERR,"Storing message to history buffer failed! Message discarded.\n");
+ if(dlt_user.overflow_counter==0)
+ {
+ dlt_log(LOG_ERR,"Buffer full! First message discarded!\n");
+ }
}
DLT_SEM_FREE();
if(dlt_user_queue_resend() < 0 && dlt_user.dlt_log_handle >= 0)
{
- dlt_log(LOG_WARNING, "dlt_forward_msg: Failed to queue resending.\n");
+ ;//dlt_log(LOG_WARNING, "dlt_forward_msg: Failed to queue resending.\n");
}
}
@@ -1123,7 +1128,7 @@ int dlt_forward_msg(void *msgdata,size_t size)
case DLT_RETURN_PIPE_FULL:
{
/* data could not be written */
- dlt_user.overflow = 1;
+ dlt_user.overflow_counter += 1;
return -1;
}
case DLT_RETURN_PIPE_ERROR:
@@ -2201,7 +2206,9 @@ void dlt_user_trace_network_segmented_thread(void *unused)
{
// Requeue if still not empty
if ( dlt_user_queue_resend() < 0 )
- dlt_log(LOG_WARNING, "Failed to queue resending in dlt_user_trace_network_segmented_thread.\n");
+ {
+ ;//dlt_log(LOG_WARNING, "Failed to queue resending in dlt_user_trace_network_segmented_thread.\n");
+ }
}
free(data);
continue;
@@ -2740,6 +2747,8 @@ int dlt_user_log_init(DltContext *handle, DltContextData *log)
int dlt_user_queue_resend(void)
{
+ static unsigned int dlt_user_queue_resend_error_counter = 0;
+
if(dlt_user.dlt_log_handle < 0)
{
// Fail silenty. FIFO is not open yet
@@ -2763,19 +2772,32 @@ int dlt_user_queue_resend(void)
/* Open queue if it is not open */
if(dlt_init_message_queue() < 0)
{
- dlt_log(LOG_ERR, "NWTSegmented: Could not open queue.\n");
- free(resend_data);
+ if(!dlt_user_queue_resend_error_counter)
+ {
+ // log error only when problem occurred first time
+ dlt_log(LOG_ERR, "NWTSegmented: Could not open queue.\n");
+ }
+ dlt_user_queue_resend_error_counter++;
+ free(resend_data);
return -1;
}
if(mq_send(dlt_user.dlt_segmented_queue_write_handle, (char *)&resend_data, sizeof(s_segmented_data *), 1) < 0)
{
- char str[255];
- snprintf(str,254,"Could not request resending.: %s \n",strerror(errno));
- dlt_log(LOG_CRIT, str);
+ if(!dlt_user_queue_resend_error_counter)
+ {
+ // log error only when problem occurred first time
+ char str[255];
+ snprintf(str,254,"Could not request resending.: %s \n",strerror(errno));
+ dlt_log(LOG_CRIT, str);
+ }
+ dlt_user_queue_resend_error_counter++;
free(resend_data);
return -1;
}
+
+ dlt_user_queue_resend_error_counter = 0;
+
//thread_data will be freed by the receiver function
//coverity[leaked_storage]
return 0;
@@ -2945,11 +2967,13 @@ DltReturnValue dlt_user_log_send_log(DltContextData *log, int mtype)
/* Reattach to daemon if neccesary */
dlt_user_log_reattach_to_daemon();
- if (dlt_user.overflow)
+ if (dlt_user.overflow_counter)
{
if (dlt_user_log_send_overflow()==0)
{
- dlt_user.overflow=0;
+ sprintf(str,"%u messages discarded!\n",dlt_user.overflow_counter);
+ dlt_log(LOG_ERR, str);
+ dlt_user.overflow_counter=0;
}
}
@@ -3000,8 +3024,12 @@ DltReturnValue dlt_user_log_send_log(DltContextData *log, int mtype)
msg.headerbuffer+sizeof(DltStorageHeader), msg.headersize-sizeof(DltStorageHeader),
log->buffer, log->size)==-1)
{
- dlt_log(LOG_ERR,"Storing message to history buffer failed! Message discarded.\n");
- ret = DLT_RETURN_BUFFER_FULL;
+ if(dlt_user.overflow_counter==0)
+ {
+
+ dlt_log(LOG_ERR,"Buffer full! Messages will be discarded.\n");
+ }
+ ret = DLT_RETURN_BUFFER_FULL;
}
DLT_SEM_FREE();
@@ -3009,7 +3037,7 @@ DltReturnValue dlt_user_log_send_log(DltContextData *log, int mtype)
// Fail silenty if FIFO is not open
if(dlt_user_queue_resend() < 0 && dlt_user.dlt_log_handle >= 0)
{
- dlt_log(LOG_WARNING, "dlt_user_log_send_log: Failed to queue resending.\n");
+ ;//dlt_log(LOG_WARNING, "dlt_user_log_send_log: Failed to queue resending.\n");
}
}
@@ -3018,12 +3046,12 @@ DltReturnValue dlt_user_log_send_log(DltContextData *log, int mtype)
case DLT_RETURN_BUFFER_FULL:
{
/* Buffer full */
+ dlt_user.overflow_counter += 1;
return DLT_RETURN_BUFFER_FULL;
}
case DLT_RETURN_PIPE_FULL:
{
/* data could not be written */
- dlt_user.overflow = 1;
return DLT_RETURN_PIPE_FULL;
}
case DLT_RETURN_PIPE_ERROR:
@@ -3122,7 +3150,7 @@ int dlt_user_log_send_register_application(void)
if(dlt_user_queue_resend() < 0 && dlt_user.dlt_log_handle >= 0)
{
- dlt_log(LOG_WARNING, "dlt_user_log_send_register_application: Failed to queue resending.\n");
+ ;//dlt_log(LOG_WARNING, "dlt_user_log_send_register_application: Failed to queue resending.\n");
}
}
@@ -3233,7 +3261,7 @@ int dlt_user_log_send_register_context(DltContextData *log)
if(dlt_user_queue_resend() < 0 && dlt_user.dlt_log_handle >= 0)
{
- dlt_log(LOG_WARNING, "dlt_user_log_send_register_context: Failed to queue resending.\n");
+ ;//dlt_log(LOG_WARNING, "dlt_user_log_send_register_context: Failed to queue resending.\n");
}
}
@@ -3743,6 +3771,7 @@ void dlt_user_log_reattach_to_daemon(void)
int dlt_user_log_send_overflow(void)
{
DltUserHeader userheader;
+ DltUserControlMsgBufferOverflow userpayload;
DltReturnValue ret;
/* set userheader */
@@ -3756,8 +3785,13 @@ int dlt_user_log_send_overflow(void)
return 0;
}
+ /* set user message parameters */
+ userpayload.overflow_counter = dlt_user.overflow_counter;
+ dlt_set_id(userpayload.apid,dlt_user.appID);
+
/* log to FIFO */
- ret=dlt_user_log_out2(dlt_user.dlt_log_handle, &(userheader), sizeof(DltUserHeader), 0, 0);
+ ret=dlt_user_log_out2(dlt_user.dlt_log_handle, &(userheader), sizeof(DltUserHeader),
+ &(userpayload), sizeof(DltUserControlMsgBufferOverflow));
return ((ret==DLT_RETURN_OK)?0:-1);
}
diff --git a/src/shared/dlt_common.c b/src/shared/dlt_common.c
index 54a99c3..f0657e6 100755
--- a/src/shared/dlt_common.c
+++ b/src/shared/dlt_common.c
@@ -2635,7 +2635,7 @@ int dlt_buffer_push3(DltBuffer *buf,const unsigned char *data1,unsigned int size
// try to increase size if possible
if(dlt_buffer_increase_size(buf)) {
/* increase size is not possible */
- dlt_log(LOG_ERR,"Buffer: Buffer is full\n");
+ //dlt_log(LOG_ERR,"Buffer: Buffer is full\n");
return -1; // ERROR
}
// update pointers
diff --git a/src/shared/dlt_user_shared.h b/src/shared/dlt_user_shared.h
index 203763a..24941a7 100755
--- a/src/shared/dlt_user_shared.h
+++ b/src/shared/dlt_user_shared.h
@@ -182,6 +182,15 @@ typedef struct
int8_t log_state; /**< the state to be used for logging state: 0 = off, 1 = external client connected */
} PACKED DltUserControlMsgLogState;
+/**
+ * This is the internal message content to get the lnumber of lost messages reported to the daemon.
+ */
+typedef struct
+{
+ uint32_t overflow_counter; /**< counts the number of lost messages */
+ char apid[4]; /**< application which lost messages */
+} PACKED DltUserControlMsgBufferOverflow;
+
/**************************************************************************************************
* The folowing functions are used shared between the user lib and the daemon implementation
**************************************************************************************************/