diff options
author | ManikandanC <Manikandan.Chockalingam@in.bosch.com> | 2017-05-22 10:57:21 +0530 |
---|---|---|
committer | Christoph Lipka <clipka@users.noreply.github.com> | 2018-12-10 15:40:58 +0100 |
commit | b2ce65d9947849160e04e751075c7fe4b5dcd158 (patch) | |
tree | 17bd0227f0d26d3557deecb83b026284975019a1 /src/daemon/dlt_daemon_connection.c | |
parent | ea836f6de185f32c14404950f5cfb2ebf084e1ca (diff) | |
download | DLT-daemon-b2ce65d9947849160e04e751075c7fe4b5dcd158.tar.gz |
Dynamic allocation of msg buffer
It is possible to change the default buffer size for log message creation via
environment variable:
export DLT_LOG_MSG_BUF_LEN=<value>
Instead of using a static buffer with size of 1390 bytes, the buffer is
allocated dynamically with the specified value.The max size is restricted to approx 65k.
Signed-off-by: Christoph Lipka <clipka@de.adit-jv.com>
Signed-off-by: ManikandanC <Manikandan.Chockalingam@in.bosch.com>
Diffstat (limited to 'src/daemon/dlt_daemon_connection.c')
-rw-r--r-- | src/daemon/dlt_daemon_connection.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/daemon/dlt_daemon_connection.c b/src/daemon/dlt_daemon_connection.c index 7e823fb..4287623 100644 --- a/src/daemon/dlt_daemon_connection.c +++ b/src/daemon/dlt_daemon_connection.c @@ -49,6 +49,7 @@ #include "dlt_daemon_socket.h" static DltConnectionId connectionId; +extern char *app_recv_buffer; /** @brief Generic sending function. * @@ -168,6 +169,11 @@ DLT_STATIC void dlt_connection_destroy_receiver(DltConnection *con) case DLT_CONNECTION_GATEWAY: /* We rely on the gateway for clean-up */ break; + case DLT_CONNECTION_APP_MSG: + dlt_receiver_free_unix_socket(con->receiver); + free(con->receiver); + con->receiver = NULL; + break; default: (void) dlt_receiver_free(con->receiver); free(con->receiver); @@ -216,11 +222,18 @@ DLT_STATIC DltReceiver *dlt_connection_get_receiver(DltDaemonLocal *daemon_local dlt_receiver_init(ret, fd, DLT_DAEMON_RCVBUFSIZESERIAL); } break; -#ifdef DLT_USE_UNIX_SOCKET_IPC - case DLT_CONNECTION_APP_CONNECT: - /* FALL THROUGH */ -#endif case DLT_CONNECTION_APP_MSG: + ret = calloc(1, sizeof(DltReceiver)); + if (ret) + { + #ifdef DLT_USE_UNIX_SOCKET_IPC + dlt_receiver_init_unix_socket(ret, fd, &app_recv_buffer); + #else + dlt_receiver_init(ret, fd, DLT_APP_RCV_BUF_MAX); + #endif + } + break; + case DLT_CONNECTION_APP_CONNECT: /* FALL THROUGH */ case DLT_CONNECTION_ONE_S_TIMER: /* FALL THROUGH */ |