Skip to content

Commit

Permalink
vty: inform CLI users that the server is going away
Browse files Browse the repository at this point in the history
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
  • Loading branch information
fabbione committed Oct 29, 2010
1 parent 958bebc commit 43a291e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions vty.c
Expand Up @@ -149,8 +149,16 @@ int knet_vty_main_loop(const char *configfile, const char *ip_addr,
se_result = select((vty_listener_fd + 1), &rfds, 0, 0, &tv);

if ((se_result == -1) && (daemon_quit)) {
log_info("Got a SIGTERM, goodbye");
/* to be 100% clean here, we should allow the threads to exit */
log_info("Got a SIGTERM, requesting CLI threads to exit");
for(conn_index = 0; conn_index <= KNET_VTY_TOTAL_MAX_CONN; conn_index++) {
if (knet_vtys[conn_index].active) {
knet_vty_write(&knet_vtys[conn_index], "\n\r\n\rServer is going down..\n\r\n\r");
knet_vty_close(&knet_vtys[conn_index]);
knet_vtys[conn_index].got_epipe = 1;
}
}
sleep(2);
log_info("Have a nice day! Goodbye");
goto out;
}

Expand Down

0 comments on commit 43a291e

Please sign in to comment.