diff options
author | Martin Mares <mj@ucw.cz> | 2000-01-16 18:40:26 +0100 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 2000-01-16 18:40:26 +0100 |
commit | bf8558bc9cab35f31bccd6a55e51f121370765c4 (patch) | |
tree | bf5396b1e4f7a9c2eff282a5f675e0cb59d1704e /nest | |
parent | ebc793a5f552bb676014f771d81c074b7dd4345d (diff) | |
download | bird-bf8558bc9cab35f31bccd6a55e51f121370765c4.tar bird-bf8558bc9cab35f31bccd6a55e51f121370765c4.zip |
Converted shutdown to a kind of reconfiguration, it's no more handled
as a exception in protocol state machines. Introduced a `shutdown'
CLI command. Killed few reconfiguration bugs.
Diffstat (limited to 'nest')
-rw-r--r-- | nest/bird.h | 4 | ||||
-rw-r--r-- | nest/proto.c | 30 | ||||
-rw-r--r-- | nest/protocol.h | 7 | ||||
-rw-r--r-- | nest/rt-table.c | 4 |
4 files changed, 7 insertions, 38 deletions
diff --git a/nest/bird.h b/nest/bird.h index b35cd31..3c7d749 100644 --- a/nest/bird.h +++ b/nest/bird.h @@ -1,7 +1,7 @@ /* * BIRD Internet Routing Daemon -- Basic Declarations * - * (c) 1998--1999 Martin Mares <mj@ucw.cz> + * (c) 1998--2000 Martin Mares <mj@ucw.cz> * * Can be freely distributed and used under the terms of the GNU GPL. */ @@ -13,6 +13,4 @@ #include "lib/birdlib.h" #include "lib/ip.h" -extern int shutting_down; /* The daemon is shutting down */ - #endif diff --git a/nest/proto.c b/nest/proto.c index ecf0d90..36829bf 100644 --- a/nest/proto.c +++ b/nest/proto.c @@ -30,8 +30,6 @@ static list inactive_proto_list; static list initial_proto_list; static list flush_proto_list; -static int proto_shutdown_counter; - static event *proto_flush_event; static char *p_states[] = { "DOWN", "START", "UP", "STOP" }; @@ -221,7 +219,7 @@ protos_commit(struct config *new, struct config *old, int force_reconfig) { struct proto *p = oc->proto; struct symbol *sym = cf_find_symbol(oc->name); - if (sym && sym->class == SYM_PROTO) + if (sym && sym->class == SYM_PROTO && !new->shutdown) { /* Found match, let's check if we can smoothly switch to new configuration */ nc = sym->def; @@ -236,7 +234,7 @@ protos_commit(struct config *new, struct config *old, int force_reconfig) { /* Generic attributes match, try converting them and then ask the protocol */ p->debug = nc->debug; - if (p->proto->reconfigure(p, nc)) + if (p->proto->reconfigure && p->proto->reconfigure(p, nc)) { DBG("\t%s: same\n", oc->name); p->cf = nc; @@ -247,6 +245,7 @@ protos_commit(struct config *new, struct config *old, int force_reconfig) /* Unsuccessful, force reconfig */ DBG("\t%s: power cycling\n", oc->name); p->cf_new = nc; + nc->proto = p; } else { @@ -290,7 +289,7 @@ proto_rethink_goal(struct proto *p) } /* Determine what state we want to reach */ - if (p->disabled || shutting_down || p->reconfiguring) + if (p->disabled || p->reconfiguring) p->core_goal = FS_HUNGRY; else p->core_goal = FS_HAPPY; @@ -321,25 +320,6 @@ proto_rethink_goal(struct proto *p) } void -protos_shutdown(void) -{ - struct proto *p, *n; - - debug("Protocol shutdown\n"); - WALK_LIST_BACKWARDS_DELSAFE(p, n, inactive_proto_list) - if (p->core_state != FS_HUNGRY || p->proto_state != PS_DOWN) - { - proto_shutdown_counter++; - proto_rethink_goal(p); - } - WALK_LIST_BACKWARDS_DELSAFE(p, n, proto_list) - { - proto_shutdown_counter++; - proto_rethink_goal(p); - } -} - -void protos_dump_all(void) { struct proto *p; @@ -389,8 +369,6 @@ proto_fell_down(struct proto *p) { DBG("Protocol %s down\n", p->name); rt_unlock_table(p->table); - if (!--proto_shutdown_counter) - protos_shutdown_notify(); proto_rethink_goal(p); } diff --git a/nest/protocol.h b/nest/protocol.h index 72f88b6..7c14f97 100644 --- a/nest/protocol.h +++ b/nest/protocol.h @@ -56,7 +56,6 @@ void protos_preconfig(struct config *); void protos_postconfig(struct config *); void protos_commit(struct config *new, struct config *old, int force_restart); void protos_dump_all(void); -void protos_shutdown(void); extern list protocol_list; @@ -251,10 +250,4 @@ struct announce_hook { struct announce_hook *proto_add_announce_hook(struct proto *, struct rtable *); -/* - * Callback to sysdep code when shutdown is finished - */ - -void protos_shutdown_notify(void); - #endif diff --git a/nest/rt-table.c b/nest/rt-table.c index b0d1e29..dcde0af 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -513,7 +513,7 @@ rt_commit(struct config *new, struct config *old) if (!ot->deleted) { struct symbol *sym = cf_find_symbol(o->name); - if (sym && sym->class == SYM_TABLE) + if (sym && sym->class == SYM_TABLE && !new->shutdown) { DBG("\t%s: same\n", o->name); r = sym->def; @@ -522,7 +522,7 @@ rt_commit(struct config *new, struct config *old) } else { - DBG("\t%s: deleted", o->name); + DBG("\t%s: deleted\n", o->name); ot->deleted = old; config_add_obstacle(old); rt_lock_table(ot); |