summaryrefslogtreecommitdiff
path: root/nest/proto.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2010-02-11 22:27:06 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2010-02-11 22:27:06 +0100
commitc83876265eeae3591bfe90375503728e633cb807 (patch)
treeee5302b85bf3d9dc1da67a9d59ca9eb4bbfd83f9 /nest/proto.c
parenta2ea1bac601ca79946e2a215dac9427c526cedab (diff)
Fixes a tricky bug in the pipe protocol.
When uncofiguring the pipe and the peer table, the peer table was unlocked when pipe protocol state changed to down/flushing and not to down/hungry. This leads to the removal of the peer table before the routes from the pipe were flushed. The fix leads to adding some pipe-specific hacks to the nest, but this seems inevitable.
Diffstat (limited to 'nest/proto.c')
-rw-r--r--nest/proto.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/nest/proto.c b/nest/proto.c
index 870edddd..c6b7e63c 100644
--- a/nest/proto.c
+++ b/nest/proto.c
@@ -133,6 +133,11 @@ proto_init_instance(struct proto *p)
p->attn = ev_new(p->pool);
p->attn->data = p;
rt_lock_table(p->table);
+
+#ifdef CONFIG_PIPE
+ if (proto_is_pipe(p))
+ rt_lock_table(pipe_get_peer_table(p));
+#endif
}
/**
@@ -583,6 +588,12 @@ proto_fell_down(struct proto *p)
bzero(&p->stats, sizeof(struct proto_stats));
rt_unlock_table(p->table);
+
+#ifdef CONFIG_PIPE
+ if (proto_is_pipe(p))
+ rt_unlock_table(pipe_get_peer_table(p));
+#endif
+
proto_rethink_goal(p);
}