summaryrefslogtreecommitdiff
path: root/src/or/rendcommon.c
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2018-04-23 20:06:34 +0000
committerMike Perry <mikeperry-git@torproject.org>2018-05-09 21:23:06 +0000
commite07e95edd35f1608ecba94b281818d27f63812e3 (patch)
tree8e571ebd65e845771fcfe72c4a8176a80e78e863 /src/or/rendcommon.c
parent7b09282dc723381e68fef79c3474a56315a0edfa (diff)
downloadtor-e07e95edd35f1608ecba94b281818d27f63812e3.tar.gz
tor-e07e95edd35f1608ecba94b281818d27f63812e3.zip
Bug 25903: Perform accounting for new CIRC_BW fields.
Two new values in each direction. DELIVERED counts valid end-to-end circuit data that is accepted by our end and OVERHEAD counts the slack unused data in each of the relay command cells for those accepted cells. Control port changes are in the next commit.
Diffstat (limited to 'src/or/rendcommon.c')
-rw-r--r--src/or/rendcommon.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index 230da4be5c..2a77b2ece7 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -12,6 +12,7 @@
#include "or.h"
#include "circuitbuild.h"
+#include "circuituse.h"
#include "config.h"
#include "control.h"
#include "hs_common.h"
@@ -807,6 +808,11 @@ rend_process_relay_cell(circuit_t *circ, const crypt_path_t *layer_hint,
tor_fragile_assert();
}
+ if (r == 0 && origin_circ) {
+ /* This was a valid cell. Count it as delivered + overhead. */
+ circuit_read_valid_data(origin_circ, length);
+ }
+
if (r == -2)
log_info(LD_PROTOCOL, "Dropping cell (type %d) for wrong circuit type.",
command);