From 9b6fdc1c2abe85008610063d800edf80e5011a4d Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sat, 10 Mar 2018 11:53:31 +0100 Subject: lib: Use PTHREAD_COND_CLOCK for blocking reads The rbuff uses the PTHREAD_COND_CLOCK for its condition variables, but the flow_read was passing a time it got from the CLOCK_REALTIME_COARSE clock. This causes the blocking reads not to timeout correctly. The oping was updated to detect server timeouts and finish gracefully. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/lib/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib/dev.c') diff --git a/src/lib/dev.c b/src/lib/dev.c index 7e829a5f..2e128d59 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -890,7 +890,7 @@ ssize_t flow_read(int fd, flow = &ai.flows[fd]; - clock_gettime(CLOCK_REALTIME_COARSE, &now); + clock_gettime(PTHREAD_COND_CLOCK, &now); pthread_rwlock_rdlock(&ai.lock); -- cgit v1.2.3