summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-11-20 07:33:55 +0000
committerRoger Dingledine <arma@torproject.org>2004-11-20 07:33:55 +0000
commitdd19cf6ba3fbde4959c0ae88f4cb5a384b0b077c (patch)
tree604e39ede08a9ee5e2fa4959a0df1483eacd3f0f
parenta30a5bce0fab1f5a16f454038666292bbd6c7740 (diff)
downloadtor-dd19cf6ba3fbde4959c0ae88f4cb5a384b0b077c.tar.gz
tor-dd19cf6ba3fbde4959c0ae88f4cb5a384b0b077c.zip
kill -USR2 now moves all logs to loglevel debug
plus fix some typos svn:r2914
-rw-r--r--src/common/log.c9
-rw-r--r--src/common/log.h1
-rw-r--r--src/or/config.c2
-rw-r--r--src/or/connection.c2
-rw-r--r--src/or/hibernate.c2
-rw-r--r--src/or/main.c26
6 files changed, 30 insertions, 12 deletions
diff --git a/src/common/log.c b/src/common/log.c
index 49ad0bd525..8c4ff3adc5 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -441,6 +441,15 @@ int get_min_log_level(void)
return min;
}
+/** Switch all logs to output at most verbose level. */
+void switch_logs_debug(void)
+{
+ logfile_t *lf;
+ for (lf = logfiles; lf; lf=lf->next) {
+ lf->loglevel = LOG_DEBUG;
+ }
+}
+
/*
Local Variables:
mode:c
diff --git a/src/common/log.h b/src/common/log.h
index b981ab4388..73726586c2 100644
--- a/src/common/log.h
+++ b/src/common/log.h
@@ -64,6 +64,7 @@ int add_syslog_log(int loglevelMin, int loglevelMax);
#endif
int add_callback_log(int loglevelMin, int loglevelMax, log_callback cb);
int get_min_log_level(void);
+void switch_logs_debug(void);
void close_logs(void);
void reset_logs(void);
void add_temp_log(void);
diff --git a/src/or/config.c b/src/or/config.c
index 05cf0a2f88..f34da4657e 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -104,7 +104,7 @@ static config_var_t config_vars[] = {
VAR("DirPort", UINT, DirPort, "0"),
VAR("DirBindAddress", LINELIST, DirBindAddress, NULL),
VAR("DirFetchPeriod", INTERVAL, DirFetchPeriod, "1 hour"),
- VAR("DirPostPeriod", INTERVAL, DirPostPeriod, "10 mintues"),
+ VAR("DirPostPeriod", INTERVAL, DirPostPeriod, "10 minutes"),
VAR("RendPostPeriod", INTERVAL, RendPostPeriod, "10 minutes"),
VAR("DirPolicy", LINELIST, DirPolicy, NULL),
VAR("DirServer", LINELIST, DirServers, NULL),
diff --git a/src/or/connection.c b/src/or/connection.c
index e2f06cea43..cec3773570 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -718,7 +718,7 @@ static void connection_consider_empty_buckets(connection_t *conn) {
}
}
-/** Initiatialize the global read bucket to options->BandwidthBurst,
+/** Initialize the global read bucket to options->BandwidthBurst,
* and current_time to the current time. */
void connection_bucket_init(void) {
or_options_t *options = get_options();
diff --git a/src/or/hibernate.c b/src/or/hibernate.c
index 054b96e00f..2407fad6cf 100644
--- a/src/or/hibernate.c
+++ b/src/or/hibernate.c
@@ -211,7 +211,7 @@ update_expected_bandwidth(void)
/* If we haven't gotten enough data last interval, guess that
* we'll be used at our maximum capacity. This is unlikely to be
* so, but it will give us an okay first estimate, and we'll stay
- * up until we send Max ytes. Next interval, we'll choose
+ * up until we send Max bytes. Next interval, we'll choose
* our starting time based on how much we sent this interval.
*/
expected_bandwidth_usage = max_configured;
diff --git a/src/or/main.c b/src/or/main.c
index b93ee6e30c..4fadd2b56b 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -50,6 +50,7 @@ static int nfds=0; /**< Number of connections currently active. */
#ifndef MS_WINDOWS /* do signal stuff only on unix */
static int please_dumpstats=0; /**< Whether we should dump stats during the loop. */
+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_reap_children=0; /**< Whether we should waitpid for exited children. */
static int please_sigpipe=0; /**< Whether we've caught a sigpipe lately. */
@@ -815,7 +816,7 @@ static int do_main_loop(void) {
}
#endif
#ifndef MS_WINDOWS /* do signal stuff only on unix */
- if(please_shutdown) {
+ if (please_shutdown) {
if(!server_mode(get_options())) { /* do it now */
log(LOG_NOTICE,"Interrupt: exiting cleanly.");
tor_cleanup();
@@ -824,16 +825,20 @@ static int do_main_loop(void) {
hibernate_begin_shutdown();
please_shutdown = 0;
}
- if(please_sigpipe) {
+ if (please_sigpipe) {
log(LOG_NOTICE,"Caught sigpipe. Ignoring.");
please_sigpipe = 0;
}
- if(please_dumpstats) {
+ if (please_dumpstats) {
/* prefer to log it at INFO, but make sure we always see it */
dumpstats(get_min_log_level()<LOG_INFO ? get_min_log_level() : LOG_INFO);
please_dumpstats = 0;
}
- if(please_reset) {
+ if (please_debug) {
+ switch_logs_debug();
+ please_debug = 0;
+ }
+ if (please_reset) {
if (do_hup() < 0) {
log_fn(LOG_WARN,"Restart failed (config error?). Exiting.");
tor_cleanup();
@@ -841,7 +846,7 @@ static int do_main_loop(void) {
}
please_reset = 0;
}
- if(please_reap_children) {
+ if (please_reap_children) {
while(waitpid(-1,NULL,WNOHANG) > 0) ; /* keep reaping until no more zombies */
please_reap_children = 0;
}
@@ -853,7 +858,7 @@ static int do_main_loop(void) {
poll_result = tor_poll(poll_array, nfds, timeout);
/* let catch() handle things like ^c, and otherwise don't worry about it */
- if(poll_result < 0) {
+ if (poll_result < 0) {
/* let the program survive things like ^z */
if(tor_socket_errno(-1) != EINTR) {
log_fn(LOG_ERR,"poll failed: %s [%d]",
@@ -869,15 +874,15 @@ static int do_main_loop(void) {
}
/* do all the reads and errors first, so we can detect closed sockets */
- for(i=0;i<nfds;i++)
+ for (i=0;i<nfds;i++)
conn_read(i); /* this also marks broken connections */
/* then do the writes */
- for(i=0;i<nfds;i++)
+ for (i=0;i<nfds;i++)
conn_write(i);
/* any of the conns need to be closed now? */
- for(i=0;i<nfds;i++)
+ for (i=0;i<nfds;i++)
conn_close_if_marked(i);
/* refilling buckets and sending cells happens at the beginning of the
@@ -910,6 +915,9 @@ static void catch(int the_signal) {
case SIGUSR1:
please_dumpstats = 1;
break;
+ case SIGUSR2:
+ please_debug = 1;
+ break;
case SIGCHLD:
please_reap_children = 1;
break;