diff options
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); |