summaryrefslogtreecommitdiffstats
path: root/nest/proto.c
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-05-19 12:46:26 +0200
committerMartin Mares <mj@ucw.cz>2000-05-19 12:46:26 +0200
commitac5d801217b4b85a5f716ace25f7f9ac48dfee0f (patch)
treecaacef3880780c5a1c498d5d0df47aafd5bce27d /nest/proto.c
parent0850ce22d76c80c4f6a10fd0139d4cc903716bfa (diff)
downloadbird-ac5d801217b4b85a5f716ace25f7f9ac48dfee0f.tar
bird-ac5d801217b4b85a5f716ace25f7f9ac48dfee0f.zip
Asynchronous feeding of protocols.
Diffstat (limited to 'nest/proto.c')
-rw-r--r--nest/proto.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/nest/proto.c b/nest/proto.c
index e81aadc..76467aa 100644
--- a/nest/proto.c
+++ b/nest/proto.c
@@ -410,6 +410,25 @@ proto_fell_down(struct proto *p)
}
static void
+proto_feed_more(void *P)
+{
+ struct proto *p = P;
+
+ DBG("Feeding protocol %s continued\n", p->name);
+ if (rt_feed_baby(p))
+ {
+ p->core_state = FS_HAPPY;
+ proto_relink(p);
+ DBG("Protocol %s up and running\n", p->name);
+ }
+ else
+ {
+ p->attn->hook = proto_feed_more;
+ ev_schedule(p->attn); /* Will continue later... */
+ }
+}
+
+static void
proto_feed(void *P)
{
struct proto *p = P;
@@ -417,10 +436,7 @@ proto_feed(void *P)
DBG("Feeding protocol %s\n", p->name);
proto_add_announce_hook(p, p->table);
if_feed_baby(p);
- rt_feed_baby(p);
- p->core_state = FS_HAPPY;
- proto_relink(p);
- DBG("Protocol %s up and running\n", p->name);
+ proto_feed_more(P);
}
void
@@ -444,8 +460,12 @@ proto_notify_state(struct proto *p, unsigned ps)
}
else if (cs == FS_FLUSHING) /* Still flushing... */
;
- else /* Need to start flushing */
- goto schedule_flush;
+ else
+ {
+ if (cs == FS_FEEDING) /* Need to abort feeding */
+ rt_feed_baby_abort(p);
+ goto schedule_flush; /* Need to start flushing */
+ }
break;
case PS_START:
ASSERT(ops == PS_DOWN);