From b25b4960512f0ca2411bc5509cec023d62fa4683 Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Sat, 9 Dec 2023 09:45:21 -0600 Subject: [PATCH] Speed up shutdown of multicast thread --- src/network.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/network.c b/src/network.c index e2272d627..b295fcb5f 100644 --- a/src/network.c +++ b/src/network.c @@ -469,6 +469,7 @@ extern void sync_callback(int lock); //! @cond Doxygen_Suppress #define MULTICAST_DATA_PIPE_TIMEOUT_MILLIS 1000 +#define MULTICAST_DATA_PIPE_TIMEOUT_USEC 100000 #if defined(WIN32) && defined(HAVE_WINDOWS_H) @@ -535,7 +536,7 @@ static int multicast_publisher_read_data(multicast_publisher_args ssize_t result; result = async_pipe_wait_for_data(mcast_publisher_args->data_pipe, - MULTICAST_DATA_PIPE_TIMEOUT_MILLIS); + MULTICAST_DATA_PIPE_TIMEOUT_USEC); if (result < 0) { @@ -659,8 +660,8 @@ static int multicast_publisher_read_data(const multicast_publisher_args ssize_t result; int retval; - timeout.tv_sec = MULTICAST_DATA_PIPE_TIMEOUT_MILLIS / 1000; - timeout.tv_usec = 0; + timeout.tv_sec = 0; + timeout.tv_usec = MULTICAST_DATA_PIPE_TIMEOUT_USEC; FD_ZERO(&rfds); FD_SET(fd, &rfds); @@ -1179,8 +1180,8 @@ void *multicast_receiver(void *arg) int select_result; ssize_t result; - timeout.tv_sec = 1; - timeout.tv_usec = 0; + timeout.tv_sec = 0; + timeout.tv_usec = 100000; FD_ZERO(&rfds); FD_SET(socket_fd, &rfds); efds = rfds; @@ -1196,7 +1197,7 @@ void *multicast_receiver(void *arg) if (select_result == 0) { // Select timed out -// rig_debug(RIG_DEBUG_ERR, "%s: select timeout\n", __FILE__); + //rig_debug(RIG_DEBUG_ERR, "%s: select timeout\n", __FILE__); continue; }