diff options
author | Karsten Loesing <karsten.loesing@gmx.net> | 2013-05-24 12:01:32 +0200 |
---|---|---|
committer | Karsten Loesing <karsten.loesing@gmx.net> | 2013-05-25 19:51:38 +0200 |
commit | 2f893624abb65a0df4f0f8ca6fbbe0c00fbf216a (patch) | |
tree | 6878bf260ef828ab871d6bb8a30f6d057dda6b9c /src/or/control.c | |
parent | a84fae789206db4e27486e693488328da7b3474a (diff) | |
download | tor-2f893624abb65a0df4f0f8ca6fbbe0c00fbf216a.tar.gz tor-2f893624abb65a0df4f0f8ca6fbbe0c00fbf216a.zip |
Tweak CONN_BW event based on comments by nickm.
- Rename read/write counters in connection_t to make it clear that these
are only used for CONN_BW events.
- Add TestingEnableConnBwEvent option.
Diffstat (limited to 'src/or/control.c')
-rw-r--r-- | src/or/control.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/or/control.c b/src/or/control.c index 2accf7f4af..10f96b345b 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -3967,10 +3967,10 @@ int control_event_conn_bandwidth(connection_t *conn) { const char *conn_type_str; - if (!get_options()->TestingTorNetwork || + if (!get_options()->TestingEnableConnBwEvent || !EVENT_IS_INTERESTING(EVENT_CONN_BW)) return 0; - if (!conn->n_read && !conn->n_written) + if (!conn->n_read_conn_bw && !conn->n_written_conn_bw) return 0; switch (conn->type) { case CONN_TYPE_OR: @@ -3990,9 +3990,9 @@ control_event_conn_bandwidth(connection_t *conn) "READ=%lu WRITTEN=%lu\r\n", U64_PRINTF_ARG(conn->global_identifier), conn_type_str, - (unsigned long)conn->n_read, - (unsigned long)conn->n_written); - conn->n_written = conn->n_read = 0; + (unsigned long)conn->n_read_conn_bw, + (unsigned long)conn->n_written_conn_bw); + conn->n_written_conn_bw = conn->n_read_conn_bw = 0; return 0; } @@ -4001,7 +4001,7 @@ control_event_conn_bandwidth(connection_t *conn) int control_event_conn_bandwidth_used(void) { - if (get_options()->TestingTorNetwork && + if (get_options()->TestingEnableConnBwEvent && EVENT_IS_INTERESTING(EVENT_CONN_BW)) { SMARTLIST_FOREACH(get_connection_array(), connection_t *, conn, control_event_conn_bandwidth(conn)); |