summaryrefslogtreecommitdiff
path: root/src/lib/dlt_user.c
diff options
context:
space:
mode:
authorChristoph Lipka <clipka@jp.adit-jv.com>2016-12-06 16:42:41 +0900
committerSaya Sugiura <ssugiura@jp.adit-jv.com>2019-05-06 15:44:49 +0900
commit4fe69b0927f4c5d0cb3b3ae4fa64500db22b13d0 (patch)
tree74ae0df4109c6f0980e45a3d0b2a29c4dfdc10f2 /src/lib/dlt_user.c
parent1348d1c07dbda69c32317738b8e9c69734f181c3 (diff)
downloadDLT-daemon-4fe69b0927f4c5d0cb3b3ae4fa64500db22b13d0.tar.gz
unix socket: IPC code isolation
Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com> Signed-off-by: Vo Trung Chi <Chi.VoTrung@vn.bosch.com>
Diffstat (limited to 'src/lib/dlt_user.c')
-rw-r--r--src/lib/dlt_user.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/lib/dlt_user.c b/src/lib/dlt_user.c
index b074172..1c1bbd8 100644
--- a/src/lib/dlt_user.c
+++ b/src/lib/dlt_user.c
@@ -331,17 +331,11 @@ static DltReturnValue dlt_initialize_fifo_connection(void)
dlt_user.dlt_log_handle = open(dlt_daemon_fifo, O_WRONLY | O_NONBLOCK | O_CLOEXEC);
if (dlt_user.dlt_log_handle == -1) {
-
- if (dlt_user.connection_state != DLT_USER_RETRY_CONNECT) {
- /* This is a normal usecase. It is OK that the daemon (and thus the FIFO /tmp/dlt)
- * starts later and some DLT users have already been started before.
- * Thus it is OK if the FIFO can't be opened. */
- dlt_vnlog(LOG_INFO, DLT_USER_BUFFER_LENGTH, "FIFO %s cannot be opened. Retrying later...\n",
- dlt_daemon_fifo);
- dlt_user.connection_state = DLT_USER_RETRY_CONNECT;
- }
-
- /*return DLT_RETURN_OK; */
+ /* This is a normal usecase. It is OK that the daemon (and thus the FIFO /tmp/dlt)
+ * starts later and some DLT users have already been started before.
+ * Thus it is OK if the FIFO can't be opened. */
+ dlt_vnlog(LOG_INFO, DLT_USER_BUFFER_LENGTH, "FIFO %s cannot be opened. Retrying later...\n",
+ dlt_daemon_fifo);
}
return DLT_RETURN_OK;
@@ -381,8 +375,9 @@ DltReturnValue dlt_init(void)
dlt_log(LOG_WARNING, str);
/*return 0; */
}
+#endif
-#elif defined DLT_USE_UNIX_SOCKET_IPC
+#ifdef DLT_USE_UNIX_SOCKET_IPC
if (dlt_initialize_socket_connection() != DLT_RETURN_OK)
/* We could connect to the pipe, but not to the socket, which is normally */
@@ -395,8 +390,6 @@ DltReturnValue dlt_init(void)
if (dlt_initialize_fifo_connection() != DLT_RETURN_OK)
return DLT_RETURN_ERROR;
- dlt_user.connection_state = DLT_USER_CONNECTED;
-
if (dlt_receiver_init(&(dlt_user.receiver), dlt_user.dlt_user_handle,
DLT_USER_RCVBUF_MAX_SIZE) == DLT_RETURN_ERROR) {
dlt_user_initialised = false;
@@ -3793,7 +3786,9 @@ DltReturnValue dlt_user_log_send_log(DltContextData *log, int mtype)
/* handle not open or pipe error */
close(dlt_user.dlt_log_handle);
dlt_user.dlt_log_handle = -1;
+#ifdef DLT_USE_UNIX_SOCKET_IPC
dlt_user.connection_state = DLT_USER_RETRY_CONNECT;
+#endif
#ifdef DLT_SHM_ENABLE
/* free shared memory */