summaryrefslogtreecommitdiff
path: root/src/lib/shm_flow_set.c
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2017-08-17 16:56:00 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2017-08-17 18:02:30 +0200
commit4d9c4025222e19dac9a90cabe8bd886e47959ad6 (patch)
tree3959a7206bfa3b5de2881d4404a2746a75aaefda /src/lib/shm_flow_set.c
parentc7cb10810c447579cb20a8bc99049baeeb8e2065 (diff)
downloadouroboros-4d9c4025222e19dac9a90cabe8bd886e47959ad6.tar.gz
ouroboros-4d9c4025222e19dac9a90cabe8bd886e47959ad6.zip
lib: Add basic FRCT mechanisms
This adds the basic FRCT mechanisms to the library. Upon flow alloc or accept an FRCT instance is now created and used when reading or writing to the flow. The timerwheel has been refactored to allow recharging timers and removing them and is now part of the library. The first SDU sent over the connection has the DRF set and this initializes the connection. Sender and receiver inactivity timers are added.
Diffstat (limited to 'src/lib/shm_flow_set.c')
-rw-r--r--src/lib/shm_flow_set.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/lib/shm_flow_set.c b/src/lib/shm_flow_set.c
index cd6946d4..2f1d4e33 100644
--- a/src/lib/shm_flow_set.c
+++ b/src/lib/shm_flow_set.c
@@ -326,10 +326,9 @@ void shm_flow_set_notify(struct shm_flow_set * set,
ssize_t shm_flow_set_wait(const struct shm_flow_set * set,
size_t idx,
int * fqueue,
- const struct timespec * timeout)
+ const struct timespec * abstime)
{
ssize_t ret = 0;
- struct timespec abstime;
assert(set);
assert(idx < AP_MAX_FQUEUES);
@@ -341,19 +340,15 @@ ssize_t shm_flow_set_wait(const struct shm_flow_set * set,
if (pthread_mutex_lock(set->lock) == EOWNERDEAD)
pthread_mutex_consistent(set->lock);
#endif
- if (timeout != NULL) {
- clock_gettime(PTHREAD_COND_CLOCK, &abstime);
- ts_add(&abstime, timeout, &abstime);
- }
pthread_cleanup_push((void(*)(void *))pthread_mutex_unlock,
(void *) set->lock);
while (set->heads[idx] == 0 && ret != -ETIMEDOUT) {
- if (timeout != NULL)
+ if (abstime != NULL)
ret = -pthread_cond_timedwait(set->conds + idx,
set->lock,
- &abstime);
+ abstime);
else
ret = -pthread_cond_wait(set->conds + idx,
set->lock);