mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Replace most bad exits in main.c, hibernate.c
This should make most of the reasons that we hibernate cleaner.
This commit is contained in:
+3
-4
@@ -818,8 +818,8 @@ hibernate_begin(hibernate_state_t new_state, time_t now)
|
||||
log_notice(LD_GENERAL,"SIGINT received %s; exiting now.",
|
||||
hibernate_state == HIBERNATE_STATE_EXITING ?
|
||||
"a second time" : "while hibernating");
|
||||
tor_cleanup();
|
||||
exit(0); // XXXX bad exit
|
||||
tor_shutdown_event_loop_and_exit(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (new_state == HIBERNATE_STATE_LOWBANDWIDTH &&
|
||||
@@ -980,8 +980,7 @@ consider_hibernation(time_t now)
|
||||
tor_assert(shutdown_time);
|
||||
if (shutdown_time <= now) {
|
||||
log_notice(LD_GENERAL, "Clean shutdown finished. Exiting.");
|
||||
tor_cleanup();
|
||||
exit(0); // XXXX bad exit
|
||||
tor_shutdown_event_loop_and_exit(0);
|
||||
}
|
||||
return; /* if exiting soon, don't worry about bandwidth limits */
|
||||
}
|
||||
|
||||
+5
-6
@@ -2776,14 +2776,13 @@ process_signal(int sig)
|
||||
{
|
||||
case SIGTERM:
|
||||
log_notice(LD_GENERAL,"Catching signal TERM, exiting cleanly.");
|
||||
tor_cleanup();
|
||||
exit(0); // XXXX bad exit
|
||||
tor_shutdown_event_loop_and_exit(0);
|
||||
break;
|
||||
case SIGINT:
|
||||
if (!server_mode(get_options())) { /* do it now */
|
||||
log_notice(LD_GENERAL,"Interrupt: exiting cleanly.");
|
||||
tor_cleanup();
|
||||
exit(0); // XXXX bad exit
|
||||
tor_shutdown_event_loop_and_exit(0);
|
||||
return;
|
||||
}
|
||||
#ifdef HAVE_SYSTEMD
|
||||
sd_notify(0, "STOPPING=1");
|
||||
@@ -2812,8 +2811,8 @@ process_signal(int sig)
|
||||
#endif
|
||||
if (do_hup() < 0) {
|
||||
log_warn(LD_CONFIG,"Restart failed (config error?). Exiting.");
|
||||
tor_cleanup();
|
||||
exit(1); // XXXX bad exit
|
||||
tor_shutdown_event_loop_and_exit(1);
|
||||
return;
|
||||
}
|
||||
#ifdef HAVE_SYSTEMD
|
||||
sd_notify(0, "READY=1");
|
||||
|
||||
Reference in New Issue
Block a user