do even less inside our signal handler,

just to be extra paranoidly safe


svn:r3050
This commit is contained in:
Roger Dingledine 2004-12-01 02:54:13 +00:00
parent b3f2a768db
commit bde1d5bfb2
3 changed files with 13 additions and 7 deletions

View File

@ -861,6 +861,7 @@ add_default_trusted_dirservers(or_options_t *options)
/* tor26 */ /* tor26 */
options->DirServers = config_line_prepend(options->DirServers, "DirServer", options->DirServers = config_line_prepend(options->DirServers, "DirServer",
"62.116.124.106:9030 847B 1F85 0344 D787 6491 A548 92F9 0493 4E4E B85D"); "62.116.124.106:9030 847B 1F85 0344 D787 6491 A548 92F9 0493 4E4E B85D");
// "tor.noreply.org:9030 847B 1F85 0344 D787 6491 A548 92F9 0493 4E4E B85D");
} }
/** Print a usage message for tor. */ /** Print a usage message for tor. */
@ -2099,7 +2100,7 @@ parse_dir_server_line(const char *line, int validate_only)
goto err; goto err;
} }
if (!port) { if (!port) {
log_fn(LOG_WARN, "Missing port in DirServe address '%s'",addrport); log_fn(LOG_WARN, "Missing port in DirServer address '%s'",addrport);
goto err; goto err;
} }
@ -2394,7 +2395,7 @@ print_cvs_version(void)
extern const char circuitlist_c_id[]; extern const char circuitlist_c_id[];
extern const char circuituse_c_id[]; extern const char circuituse_c_id[];
extern const char command_c_id[]; extern const char command_c_id[];
extern const char config_c_id[]; // extern const char config_c_id[];
extern const char connection_c_id[]; extern const char connection_c_id[];
extern const char connection_edge_c_id[]; extern const char connection_edge_c_id[];
extern const char connection_or_c_id[]; extern const char connection_or_c_id[];

View File

@ -55,7 +55,8 @@ static int please_debug=0; /**< Whether we should switch all logs to -l debug. *
static int please_reset=0; /**< Whether we just got a sighup. */ static int please_reset=0; /**< Whether we just got a sighup. */
static int please_reap_children=0; /**< Whether we should waitpid for exited children. */ static int please_reap_children=0; /**< Whether we should waitpid for exited children. */
static int please_sigpipe=0; /**< Whether we've caught a sigpipe lately. */ static int please_sigpipe=0; /**< Whether we've caught a sigpipe lately. */
static int please_shutdown=0; /**< Whether we should shut down Tor. */ static int please_shutdown=0; /**< Whether we should slowly shut down Tor. */
static int please_die=0; /**< Whether we should immediately shut down Tor. */
#endif /* signal stuff */ #endif /* signal stuff */
/** We set this to 1 when we've fetched a dir, to know whether to complain /** We set this to 1 when we've fetched a dir, to know whether to complain
@ -826,6 +827,11 @@ static int do_main_loop(void) {
} }
#endif #endif
#ifndef MS_WINDOWS /* do signal stuff only on unix */ #ifndef MS_WINDOWS /* do signal stuff only on unix */
if (please_die) {
log(LOG_ERR,"Catching signal TERM, exiting cleanly.");
tor_cleanup();
exit(0);
}
if (please_shutdown) { if (please_shutdown) {
if (!server_mode(get_options())) { /* do it now */ if (!server_mode(get_options())) { /* do it now */
log(LOG_NOTICE,"Interrupt: exiting cleanly."); log(LOG_NOTICE,"Interrupt: exiting cleanly.");
@ -909,9 +915,8 @@ static void catch(int the_signal) {
switch (the_signal) { switch (the_signal) {
// case SIGABRT: // case SIGABRT:
case SIGTERM: case SIGTERM:
log(LOG_ERR,"Catching signal %d, exiting cleanly.", the_signal); please_die = 1;
tor_cleanup(); break;
exit(0);
case SIGINT: case SIGINT:
please_shutdown = 1; please_shutdown = 1;
break; break;

View File

@ -247,7 +247,7 @@ void rep_hist_note_extend_failed(const char *from_id, const char *to_id)
hist->changed = time(NULL); hist->changed = time(NULL);
} }
/** Log all the reliability data we have rememberred, with the chosen /** Log all the reliability data we have remembered, with the chosen
* severity. * severity.
*/ */
void rep_hist_dump_stats(time_t now, int severity) void rep_hist_dump_stats(time_t now, int severity)