From: Nick Mathewson Date: Wed, 18 Aug 2010 14:06:14 +0000 (-0400) Subject: Merge commit 'karsten/dirbytes2' X-Git-Tag: tor-0.2.2.15-alpha~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a509dbba504f7b5e2c1d93bad25e500493b06fb5;p=thirdparty%2Ftor.git Merge commit 'karsten/dirbytes2' Conflicts: src/or/rephist.h --- a509dbba504f7b5e2c1d93bad25e500493b06fb5 diff --cc src/or/connection.c index a16eb37a14,99ce7fffef..c040be041e --- a/src/or/connection.c +++ b/src/or/connection.c @@@ -2095,7 -2093,19 +2093,17 @@@ connection_buckets_decrement(connection tor_fragile_assert(); } + /* Count bytes of answering direct and tunneled directory requests */ + if (conn->type == CONN_TYPE_DIR && conn->purpose == DIR_PURPOSE_SERVER) { + if (num_read > 0) + rep_hist_note_dir_bytes_read(num_read, now); + if (num_written > 0) + rep_hist_note_dir_bytes_written(num_written, now); + } + + if (!connection_is_rate_limited(conn)) + return; /* local IPs are free */ if (num_read > 0) { - if (conn->type == CONN_TYPE_EXIT) - rep_hist_note_exit_bytes_read(conn->port, num_read); rep_hist_note_bytes_read(num_read, now); } if (num_written > 0) { diff --cc src/or/rephist.h index 02ab2f1cbd,dc756df501..c3914dcaf2 --- a/src/or/rephist.h +++ b/src/or/rephist.h @@@ -23,6 -23,14 +23,10 @@@ void rep_hist_note_extend_failed(const void rep_hist_dump_stats(time_t now, int severity); void rep_hist_note_bytes_read(size_t num_bytes, time_t when); void rep_hist_note_bytes_written(size_t num_bytes, time_t when); ++ + void rep_hist_note_dir_bytes_read(size_t num_bytes, time_t when); + void rep_hist_note_dir_bytes_written(size_t num_bytes, time_t when); -void rep_hist_note_exit_bytes_read(uint16_t port, size_t num_bytes); -void rep_hist_note_exit_bytes_written(uint16_t port, size_t num_bytes); -void rep_hist_note_exit_stream_opened(uint16_t port); -void rep_hist_exit_stats_init(time_t now); -time_t rep_hist_exit_stats_write(time_t now); -void rep_hist_exit_stats_term(void); ++ int rep_hist_bandwidth_assess(void); char *rep_hist_get_bandwidth_lines(int for_extrainfo); void rep_hist_update_state(or_state_t *state);