aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-07-04 22:48:11 +0000
committerRoger Dingledine <arma@torproject.org>2004-07-04 22:48:11 +0000
commitcbf73b2bc531bee4b64eaaa3c2d4efc55261dc4c (patch)
treef91c7d65b3350304b78e2cf36f0e227b146b20bd
parent5284826a05afe0c2226e566b24354cd87ce6bbe2 (diff)
downloadtor-cbf73b2bc531bee4b64eaaa3c2d4efc55261dc4c.tar.gz
tor-cbf73b2bc531bee4b64eaaa3c2d4efc55261dc4c.zip
touchups all over
put uptime in descriptor svn:r2011
-rw-r--r--src/or/config.c22
-rw-r--r--src/or/connection.c5
-rw-r--r--src/or/main.c8
-rw-r--r--src/or/router.c4
-rw-r--r--src/or/routerlist.c2
5 files changed, 18 insertions, 23 deletions
diff --git a/src/or/config.c b/src/or/config.c
index ee3857a92a..03d8865218 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -259,8 +259,6 @@ static int config_assign(or_options_t *options, struct config_line_t *list) {
return 0;
}
-/* XXX are there any other specifiers we want to give so making
- * a several-thousand-byte string is less painful? */
const char default_dirservers_string[] =
"router moria1 18.244.0.188 9001 9021 9031\n"
"platform Tor 0.0.6rc1 on Linux moria.mit.edu i686\n"
@@ -380,15 +378,16 @@ int config_assign_default_dirservers(void) {
/** Set <b>options</b> to a reasonable default.
*
- * Call this function when they're using the default torrc but
- * we can't find it. For now, we just hard-code what comes in the
- * default torrc.
+ * Call this function when we can't find any torrc config file.
*/
-static int config_assign_default(or_options_t *options) {
+static int config_assign_defaults(or_options_t *options) {
/* set them up as a client only */
options->SocksPort = 9050;
+ config_free_lines(options->ExitPolicy);
+ options->ExitPolicy = config_line_prepend(NULL, "ExitPolicy", "reject *:*");
+
/* plus give them a dirservers file */
if(config_assign_default_dirservers() < 0)
return -1;
@@ -585,7 +584,7 @@ int getconfig(int argc, char **argv, or_options_t *options) {
if(!cf) {
if(using_default_torrc == 1) {
log(LOG_NOTICE, "Configuration file '%s' not present, using reasonable defaults.",fname);
- if(config_assign_default(options) < 0)
+ if(config_assign_defaults(options) < 0)
return -1;
} else {
log(LOG_WARN, "Unable to open configuration file '%s'.",fname);
@@ -631,13 +630,6 @@ int getconfig(int argc, char **argv, or_options_t *options) {
result = -1;
}
-#if 0
- if(options->ORPort && options->DataDirectory == NULL) {
- log(LOG_WARN,"DataDirectory option required if ORPort is set, but not found.");
- result = -1;
- }
-#endif
-
if (options->ORPort) {
if (options->Nickname == NULL) {
log_fn(LOG_WARN,"Nickname required if ORPort is set, but not found.");
@@ -676,7 +668,7 @@ int getconfig(int argc, char **argv, or_options_t *options) {
result = -1;
}
- if(options->DirPort && options->RecommendedVersions == NULL) {
+ if(options->AuthoritativeDir && options->RecommendedVersions == NULL) {
log(LOG_WARN,"Directory servers must configure RecommendedVersions.");
result = -1;
}
diff --git a/src/or/connection.c b/src/or/connection.c
index 00ef5ab95f..90c8197c46 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -235,8 +235,9 @@ void connection_close_immediate(connection_t *conn)
return;
}
if (conn->outbuf_flushlen) {
- log_fn(LOG_INFO,"Closing connection (fd %d, type %s, state %d) with data on outbuf.",
- conn->s, CONN_TYPE_TO_STRING(conn->type), conn->state);
+ log_fn(LOG_INFO,"fd %d, type %s, state %d, %d bytes on outbuf.",
+ conn->s, CONN_TYPE_TO_STRING(conn->type),
+ conn->state, conn->outbuf_flushlen);
}
tor_close_socket(conn->s);
conn->s = -1;
diff --git a/src/or/main.c b/src/or/main.c
index ce0d6936cb..77189e62fd 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -28,7 +28,7 @@ static int stats_prev_global_read_bucket;
/** How many bytes have we read since we started the process? */
static uint64_t stats_n_bytes_read = 0;
/** How many seconds have we been running? */
-static long stats_n_seconds_reading = 0;
+long stats_n_seconds_uptime = 0;
/** Array of all open connections; each element corresponds to the element of
* poll_array in the same position. The first nfds elements are valid. */
@@ -536,7 +536,7 @@ static int prepare_for_poll(void) {
if(now.tv_sec > current_second) { /* the second has rolled over. check more stuff. */
- ++stats_n_seconds_reading;
+ ++stats_n_seconds_uptime;
assert_all_pending_dns_resolves_ok();
run_scheduled_events(now.tv_sec);
assert_all_pending_dns_resolves_ok();
@@ -844,9 +844,9 @@ static void dumpstats(int severity) {
100*(((double)stats_n_data_bytes_received) /
(stats_n_data_cells_received*RELAY_PAYLOAD_SIZE)) );
- if (stats_n_seconds_reading)
+ if (stats_n_seconds_uptime)
log(severity,"Average bandwidth used: %d bytes/sec",
- (int) (stats_n_bytes_read/stats_n_seconds_reading));
+ (int) (stats_n_bytes_read/stats_n_seconds_uptime));
rep_hist_dump_stats(now,severity);
rend_service_dump_stats(severity);
diff --git a/src/or/router.c b/src/or/router.c
index 1786873098..523abb5773 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -11,6 +11,7 @@
**/
extern or_options_t options; /* command-line and config-file options */
+extern long stats_n_seconds_uptime;
/** Exposed for test.c. */ void get_platform_str(char *platform, int len);
@@ -474,7 +475,8 @@ int router_rebuild_descriptor(void) {
*/
void get_platform_str(char *platform, int len)
{
- snprintf(platform, len-1, "Tor %s on %s", VERSION, get_uname());
+ snprintf(platform, len-1, "Tor %s (up %ld sec) on %s",
+ VERSION, stats_n_seconds_uptime, get_uname());
platform[len-1] = '\0';
return;
}
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 1d03a6d1b0..1bd21e4411 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -124,7 +124,7 @@ void add_nickname_list_to_smartlist(smartlist_t *sl, const char *list) {
if (router->is_running)
smartlist_add(sl,router);
else
- log_fn(LOG_INFO,"Nickname list includes '%s' which is known but down.",nick);
+ log_fn(LOG_WARN,"Nickname list includes '%s' which is known but down.",nick);
} else
log_fn(has_fetched_directory ? LOG_WARN : LOG_INFO,
"Nickname list includes '%s' which isn't a known router.",nick);