diff options
author | paulo <paul@bayleaf.org.uk> | 2010-01-25 16:18:53 +0000 |
---|---|---|
committer | paulo <paul@bayleaf.org.uk> | 2010-01-25 16:18:53 +0000 |
commit | 649f8b0429dc1b25d65c34ee461e448d8f56f410 (patch) | |
tree | 9c8185dc2e1319a425eeb1ac75b10f27c1d60674 /bgpd/bgp_main.c | |
parent | c21f7fd3e23791cb6ea8a3b0b968af8892c75931 (diff) | |
download | quagga-649f8b0429dc1b25d65c34ee461e448d8f56f410.tar.bz2 quagga-649f8b0429dc1b25d65c34ee461e448d8f56f410.tar.xz |
Fixed problems in mqueue keeping tail pointers correct. Implemented
program terminate code that waits for all sissions to become disabled
before terminating pthreads and running exit code.
Diffstat (limited to 'bgpd/bgp_main.c')
-rw-r--r-- | bgpd/bgp_main.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index 88068017..2916c70f 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -216,21 +216,25 @@ sigint (void) #endif zlog_notice ("Terminating on signal"); - /* tell the routing engine */ - sigterm_enqueue(); - - /* TODO: very temporary kludge to test if bgp engine does close */ - sleep(20); - - /* ask remaining pthreads to die */ - if (qpthreads_enabled && routing_nexus != NULL) + if (!retain_mode) + { + /* tell the routing engine to send notifies to peers and wait + * for all sessions to be disabled */ + sigterm_enqueue(); + } + else + { + /* ask remaining pthreads to die */ + if (qpthreads_enabled && routing_nexus != NULL) qpn_terminate(routing_nexus); - if (qpthreads_enabled && bgp_nexus != NULL) + if (qpthreads_enabled && bgp_nexus != NULL) qpn_terminate(bgp_nexus); - if (cli_nexus != NULL) - qpn_terminate(cli_nexus); + if (cli_nexus != NULL) + qpn_terminate(cli_nexus); + } + } /* SIGUSR1 handler. */ @@ -644,7 +648,7 @@ sighup_action(mqueue_block mqb, mqb_flag_t flag) { if (flag == mqb_action) { - bgp_terminate (); + bgp_terminate (0); /* send notfies */ bgp_reset (); } @@ -665,9 +669,9 @@ sigterm_action(mqueue_block mqb, mqb_flag_t flag) { if (flag == mqb_action) { - /* send notify to all peers, unless retaining routes */ - if (!retain_mode) - bgp_terminate(); + /* send notify to all peers, wiat for alll sessions to be disables + * then terminate all pthreads */ + bgp_terminate(1); } mqb_free(mqb); |