Skip to content

Commit

Permalink
dlt_user: fix invalid poll timeout
Browse files Browse the repository at this point in the history
The poll timeout was only set for fifo.
TCP connections require this timeout as well.
dlt_user_log_check_user_message also validated the file descriptor
to be greater 0.
Because 0 is a valid file descriptor this check has been changed
to greater or equal 0.
poll receives a timeout in milliseconds.
The given paramter was in nanoseconds.
An additional define takes adds the delay in miliseconds.

Signed-off-by: Alexander Mohr <[email protected]>
  • Loading branch information
Alexander Mohr committed Dec 17, 2020
1 parent 6fade05 commit b748545
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/lib/dlt_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -4242,13 +4242,8 @@ DltReturnValue dlt_user_log_check_user_message(void)
nfd[0].events = POLLIN;
nfd[0].fd = fd;

#if defined DLT_LIB_USE_UNIX_SOCKET_IPC || defined DLT_LIB_USE_VSOCK_IPC
if (fd != DLT_FD_INIT) {
ret = poll(nfd, 1, -1);
#else /* DLT_LIB_USE_FIFO_IPC */
if (fd != DLT_FD_INIT && dlt_user.dlt_log_handle > 0) {
ret = poll(nfd, 1, DLT_USER_RECEIVE_NDELAY);
#endif
if (fd >= 0) {
ret = poll(nfd, 1, 1000);
if (ret) {
if (nfd[0].revents & (POLLHUP | POLLNVAL | POLLERR)) {
dlt_user.dlt_log_handle = DLT_FD_INIT;
Expand Down

0 comments on commit b748545

Please sign in to comment.