diff options
author | potentiate <potentiate@netherworld.(none)> | 2009-05-14 05:20:27 -0700 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2009-05-14 17:50:06 -0400 |
commit | 1b61c8bf377759345e761b0e7bac35c9fbf52f61 (patch) | |
tree | 44acec708f96c8e20dd5f7ee3be96868bc8b7169 /src/or/control.c | |
parent | 479d21254ac49f6493087ce1385bcfe8d84476d4 (diff) | |
download | tor-1b61c8bf377759345e761b0e7bac35c9fbf52f61.tar.gz tor-1b61c8bf377759345e761b0e7bac35c9fbf52f61.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 53b9952481..c5fd688e3d 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -3258,6 +3258,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 |