summaryrefslogtreecommitdiff
path: root/src/lib/rib.c
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2017-03-25 18:48:30 +0100
committerSander Vrijders <sander.vrijders@ugent.be>2017-03-28 10:24:54 +0200
commitc0bfc1752df3530570a24c930220b94a4e3afabb (patch)
tree43abd2084831d5a36c88a8ad93b3dec3e48127cd /src/lib/rib.c
parentd3393da62009e49b5724f8ff3d901c244ab8d557 (diff)
downloadouroboros-c0bfc1752df3530570a24c930220b94a4e3afabb.tar.gz
ouroboros-c0bfc1752df3530570a24c930220b94a4e3afabb.zip
lib, ipcpd: Fix bugs in ro sets
This fixes several bugs in the ro sets, rib. And it fixes several bugs in the graph and routing component of the normal IPCP.
Diffstat (limited to 'src/lib/rib.c')
-rw-r--r--src/lib/rib.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/rib.c b/src/lib/rib.c
index 8468e88c..fc58f266 100644
--- a/src/lib/rib.c
+++ b/src/lib/rib.c
@@ -177,6 +177,8 @@ static struct revent * revent_dup(struct revent * ev)
re->flags = ev->flags;
+ list_head_init(&re->next);
+
return re;
}
@@ -196,7 +198,13 @@ static void rnode_notify_subs(struct rnode * node,
struct rn_sub * s = list_entry(p, struct rn_sub, next);
if (s->flags & ev->flags) {
struct revent * e = revent_dup(ev);
+ if (e == NULL)
+ continue;
+
+ pthread_mutex_lock(&s->sub->lock);
list_add_tail(&e->next, &s->sub->events);
+ pthread_cond_signal(&s->sub->cond);
+ pthread_mutex_unlock(&s->sub->lock);
}
if (ev->flags & RO_DELETE)
@@ -1130,7 +1138,7 @@ int rib_event_wait(ro_set_t * set,
while (list_is_empty(&sub->events) && ret != -ETIMEDOUT) {
if (timeout != NULL)
- ret = -pthread_cond_timedwait(&sub->cond ,
+ ret = -pthread_cond_timedwait(&sub->cond,
&sub->lock,
&abstime);
else