summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-10-22 16:12:29 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-10-22 16:12:29 +0200
commit2bc5cafc514ab92c389ce0d7dd376f89dfa7bb8e (patch)
treebf2aadef902a6bbddcccc82e5059dc3c44f11b30
parentdc41c0ebfae020368ccf832f0fe0528ceb137f2c (diff)
downloadouroboros-2bc5cafc514ab92c389ce0d7dd376f89dfa7bb8e.tar.gz
ouroboros-2bc5cafc514ab92c389ce0d7dd376f89dfa7bb8e.zip
lib: Revert bad fqueue modification
An untested (and wrong) modification to the fqueue was mistakenly added to a previous commit. This corrects the bad code.
-rw-r--r--src/lib/dev.c3
-rw-r--r--src/lib/shm_flow_set.c4
2 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c
index f737b74c..41841988 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -960,12 +960,13 @@ int flow_event_wait(struct flow_set * set,
if (fq->fqsize > 0)
return 0;
+ assert(!fq->next);
+
ret = shm_flow_set_wait(ai.fqset, set->idx, fq->fqueue, timeout);
if (ret == -ETIMEDOUT)
return -ETIMEDOUT;
fq->fqsize = ret;
- fq->next = 0;
return 0;
}
diff --git a/src/lib/shm_flow_set.c b/src/lib/shm_flow_set.c
index f68773aa..3b1af83f 100644
--- a/src/lib/shm_flow_set.c
+++ b/src/lib/shm_flow_set.c
@@ -356,6 +356,7 @@ ssize_t shm_flow_set_wait(const struct shm_flow_set * shm_set,
assert(shm_set);
assert(idx < AP_MAX_FQUEUES);
+ assert(fqueue);
#ifdef __APPLE__
pthread_mutex_lock(shm_set->lock);
@@ -397,10 +398,11 @@ ssize_t shm_flow_set_wait(const struct shm_flow_set * shm_set,
memcpy(fqueue,
fqueue_ptr(shm_set, idx),
shm_set->heads[idx] * sizeof(int));
+ ret = shm_set->heads[idx];
shm_set->heads[idx] = 0;
}
pthread_cleanup_pop(true);
- return 0;
+ return ret;
}