diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-09-08 06:52:33 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-09-08 06:52:33 +0000 |
commit | c66e4c48704b8be1425c2b6253542beed49ce0eb (patch) | |
tree | bab663d3eaff8366181c3dc75ba6a17ec5cfaca1 /src/or/main.c | |
parent | b6798866d058cd7ce69fc3c7944aff85a1693170 (diff) | |
download | tor-c66e4c48704b8be1425c2b6253542beed49ce0eb.tar tor-c66e4c48704b8be1425c2b6253542beed49ce0eb.tar.gz |
Flush more changes from sandbox
- make clients cache directories and use them to seed their router lists
at startup. This means clients have a datadir again.
- Introduce a global_write_bucket. We need to respond better to exhausting
it.
- Remove the last vestiges of LinkPadding and TrafficShaping.
- Configuration infrastructure support for warning on obsolete options.
- Refactor directory header parsing to use smartlist_split_string.
- Respond to content-encoding headers by trying to uncompress as appropriate.
- Reply with a deflated directory when a client asks for "dir.z".
(We could use allow-encodings instead, but allow-encodings isn't
specified in HTTP 1.0.)
svn:r2335
Diffstat (limited to 'src/or/main.c')
-rw-r--r-- | src/or/main.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/or/main.c b/src/or/main.c index 9e558315a..9bdebbbb1 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -21,12 +21,17 @@ extern char *conn_state_to_string[][_CONN_TYPE_MAX+1]; or_options_t options; /**< Command-line and config-file options. */ int global_read_bucket; /**< Max number of bytes I can read this second. */ +int global_write_bucket; /**< Max number of bytes I can write this second. */ /** What was the read bucket before the last call to prepare_for_pool? * (used to determine how many bytes we've read). */ static int stats_prev_global_read_bucket; -/** How many bytes have we read since we started the process? */ +/** What was the write bucket before the last call to prepare_for_pool? + * (used to determine how many bytes we've written). */ +static int stats_prev_global_write_bucket; +/** How many bytes have we read/written since we started the process? */ static uint64_t stats_n_bytes_read = 0; +static uint64_t stats_n_bytes_written = 0; /** How many seconds have we been running? */ long stats_n_seconds_uptime = 0; @@ -632,8 +637,10 @@ static int prepare_for_poll(void) { /* Check how much bandwidth we've consumed, and increment the token * buckets. */ stats_n_bytes_read += stats_prev_global_read_bucket - global_read_bucket; + stats_n_bytes_written += stats_prev_global_write_bucket - global_write_bucket; connection_bucket_refill(&now); stats_prev_global_read_bucket = global_read_bucket; + stats_prev_global_write_bucket = global_write_bucket; if(now.tv_sec > current_second) { /* the second has rolled over. check more stuff. */ @@ -698,6 +705,7 @@ static int init_from_config(int argc, char **argv) { /* Set up our buckets */ connection_bucket_init(); stats_prev_global_read_bucket = global_read_bucket; + stats_prev_global_write_bucket = global_write_bucket; /* Finish backgrounding the process */ if(options.RunAsDaemon) { @@ -782,15 +790,8 @@ static int do_main_loop(void) { } /* load the routers file, or assign the defaults. */ - if(options.RouterFile) { - routerlist_clear_trusted_directories(); - if (router_load_routerlist_from_file(options.RouterFile, 1) < 0) { - log_fn(LOG_ERR,"Error loading router list."); - return -1; - } - } else { - if(config_assign_default_dirservers() < 0) - return -1; + if(router_reload_router_list()) { + return -1; } if(authdir_mode()) { |