diff options
author | Mike Perry <mikeperry-git@fscked.org> | 2009-05-14 05:20:27 -0700 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2009-05-14 17:52:26 -0400 |
commit | 29bf271ba2deb9714f515e03a9674ac43b9d7156 (patch) | |
tree | f2cd5fcebf52f67ab26865429b3582d4165c472f /src/or/control.c | |
parent | 45171cd9e9cb492bd64a1251dcd7758cab686f4b (diff) | |
download | tor-29bf271ba2deb9714f515e03a9674ac43b9d7156.tar.gz tor-29bf271ba2deb9714f515e03a9674ac43b9d7156.zip |
Fix misreporting of stream bandwidths.
Diffstat (limited to 'src/or/control.c')
-rw-r--r-- | src/or/control.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/or/control.c b/src/or/control.c index 26758de71c..3e0fb84c81 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -3275,6 +3275,28 @@ control_event_or_conn_status(or_connection_t *conn, or_conn_status_event_t tp, return 0; } +/** + * Print out STREAM_BW event for a single conn + */ +int +control_event_stream_bandwidth(edge_connection_t *edge_conn) +{ + if (EVENT_IS_INTERESTING(EVENT_STREAM_BANDWIDTH_USED)) { + if (!edge_conn->n_read && !edge_conn->n_written) + return 0; + + send_control_event(EVENT_STREAM_BANDWIDTH_USED, ALL_NAMES, + "650 STREAM_BW "U64_FORMAT" %lu %lu\r\n", + U64_PRINTF_ARG(edge_conn->_base.global_identifier), + (unsigned long)edge_conn->n_read, + (unsigned long)edge_conn->n_written); + + edge_conn->n_written = edge_conn->n_read = 0; + } + + return 0; +} + /** A second or more has elapsed: tell any interested control * connections how much bandwidth streams have used. */ int |