summaryrefslogtreecommitdiff
path: root/src/daemon/dlt-daemon.c
diff options
context:
space:
mode:
authorFelix Herrmann <fherrmann@de.adit-jv.com>2020-06-03 16:46:40 +0200
committerSaya Sugiura <39760799+ssugiura@users.noreply.github.com>2020-07-06 10:04:07 +0900
commitb185489eb4445bd1d5bca1f82c8e52af258ee69a (patch)
tree385c84272cc0452266f300722385bd3d96d2a224 /src/daemon/dlt-daemon.c
parent06b71ade4ad5f988ef18dcbec1e5e28b0ce57166 (diff)
downloadDLT-daemon-b185489eb4445bd1d5bca1f82c8e52af258ee69a.tar.gz
limit logspam in gateway on client overflow
update client buffer overflow counter in send function. Gather all overflow checks into dlt_daemon_client. Signed-off-by: Felix Herrmann <fherrmann@de.adit-jv.com> Signed-off-by: KHANH LUONG HONG DUY <khanh.luonghongduy@vn.bosch.com>
Diffstat (limited to 'src/daemon/dlt-daemon.c')
-rw-r--r--src/daemon/dlt-daemon.c30
1 files changed, 7 insertions, 23 deletions
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c
index 7abd4d5..cb9b7f0 100644
--- a/src/daemon/dlt-daemon.c
+++ b/src/daemon/dlt-daemon.c
@@ -1636,7 +1636,6 @@ int dlt_daemon_log_internal(DltDaemon *daemon, DltDaemonLocal *daemon_local, cha
uint32_t uiType;
uint16_t uiSize;
uint32_t uiExtraSize;
- int ret;
PRINT_FUNCTION_VERBOSE(verbose);
@@ -1692,20 +1691,14 @@ int dlt_daemon_log_internal(DltDaemon *daemon, DltDaemonLocal *daemon_local, cha
memcpy((uint8_t *)(msg.databuffer + msg.datasize), str, uiSize);
msg.datasize += uiSize;
- /* Calc lengths */
+ /* Calc length */
msg.standardheader->len = DLT_HTOBE_16(msg.headersize - sizeof(DltStorageHeader) + msg.datasize);
- /* Sending data... */
- {
- ret = dlt_daemon_client_send(DLT_DAEMON_SEND_TO_ALL, daemon,daemon_local,
- msg.headerbuffer, sizeof(DltStorageHeader),
- msg.headerbuffer + sizeof(DltStorageHeader),
- msg.headersize - sizeof(DltStorageHeader),
- msg.databuffer, msg.datasize, verbose);
-
- if (ret == DLT_DAEMON_ERROR_BUFFER_FULL)
- daemon->overflow_counter++;
- }
+ dlt_daemon_client_send(DLT_DAEMON_SEND_TO_ALL, daemon,daemon_local,
+ msg.headerbuffer, sizeof(DltStorageHeader),
+ msg.headerbuffer + sizeof(DltStorageHeader),
+ msg.headersize - sizeof(DltStorageHeader),
+ msg.databuffer, msg.datasize, verbose);
free(msg.databuffer);
@@ -2869,16 +2862,7 @@ int dlt_daemon_process_user_message_log(DltDaemon *daemon,
return DLT_DAEMON_ERROR_UNKNOWN;
}
- ret = dlt_daemon_client_send_message_to_all_client(daemon,
- daemon_local, verbose);
-
- if (ret == DLT_DAEMON_ERROR_BUFFER_FULL && daemon->overflow_counter == 1) {
- dlt_vlog(LOG_WARNING, "%s: buffer full, messages will be discarded.\n",
- __func__);
- } else if (ret != DLT_DAEMON_ERROR_OK &&
- ret != DLT_DAEMON_ERROR_BUFFER_FULL) {
- dlt_vlog(LOG_ERR, "%s: failed to send message to client\n", __func__);
- }
+ dlt_daemon_client_send_message_to_all_client(daemon, daemon_local, verbose);
/* keep not read data in buffer */
size = daemon_local->msg.headersize +