summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2017-08-22 17:00:14 +0000
committerdimitri staessens <dimitri.staessens@ugent.be>2017-08-22 17:00:14 +0000
commit86523803ed5ca7092a9f8592dfc3b5476801b30f (patch)
treed8c3193215c893f403ed7ea0a6a6a7ce7ec44263
parent831c4be1fb1c46cb46b2538059796c8fec5a7543 (diff)
parent494394829de2a0aa96321103ad3734c3e8e5280e (diff)
downloadouroboros-86523803ed5ca7092a9f8592dfc3b5476801b30f.tar.gz
ouroboros-86523803ed5ca7092a9f8592dfc3b5476801b30f.zip
Merged in sandervrijders/ouroboros/be-crc (pull request #563)
lib: Fix timeout value of flow_event_wait
-rw-r--r--src/lib/dev.c10
-rw-r--r--src/lib/shm_flow_set.c2
2 files changed, 7 insertions, 5 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c
index 894a7bab..c21e621a 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -1289,8 +1289,9 @@ int flow_event_wait(struct flow_set * set,
struct fqueue * fq,
const struct timespec * timeout)
{
- ssize_t ret;
- struct timespec abstime;
+ ssize_t ret;
+ struct timespec abstime;
+ struct timespec * t = NULL;
if (set == NULL || fq == NULL)
return -EINVAL;
@@ -1303,13 +1304,14 @@ int flow_event_wait(struct flow_set * set,
if (timeout != NULL) {
clock_gettime(PTHREAD_COND_CLOCK, &abstime);
ts_add(&abstime, timeout, &abstime);
+ t = &abstime;
}
if (set->np1_set)
- ret = frcti_event_wait(set, fq, &abstime);
+ ret = frcti_event_wait(set, fq, t);
else
ret = shm_flow_set_wait(ai.fqset, set->idx,
- fq->fqueue, &abstime);
+ fq->fqueue, t);
if (ret == -ETIMEDOUT) {
fq->fqsize = 0;
diff --git a/src/lib/shm_flow_set.c b/src/lib/shm_flow_set.c
index f4a70689..78fdce36 100644
--- a/src/lib/shm_flow_set.c
+++ b/src/lib/shm_flow_set.c
@@ -364,7 +364,7 @@ ssize_t shm_flow_set_wait(const struct shm_flow_set * set,
set->lock,
abstime);
#ifdef HAVE_CANCEL_BUG
- if (ret == -ETIMEDOUT)
+ if (ret == -ETIMEDOUT)
pthread_testcancel();
#endif
} else {