From b2ce65d9947849160e04e751075c7fe4b5dcd158 Mon Sep 17 00:00:00 2001 From: ManikandanC Date: Mon, 22 May 2017 10:57:21 +0530 Subject: 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= 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 Signed-off-by: ManikandanC --- src/daemon/dlt_daemon_connection.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/daemon/dlt_daemon_connection.c') 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 */ -- cgit v1.2.1