aboutsummaryrefslogtreecommitdiff
path: root/src/or/relay.c
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2018-02-12 09:11:14 +0000
committerMike Perry <mikeperry-git@torproject.org>2018-04-16 21:46:12 +0000
commitdfa6808f57e5856edd4e25a957f3f06707264199 (patch)
treeddc2e65780d74d92872a4036e08390feed53940c /src/or/relay.c
parentae4e5b98245169dc02c12138d4acc69ce7da0261 (diff)
downloadtor-dfa6808f57e5856edd4e25a957f3f06707264199.tar.gz
tor-dfa6808f57e5856edd4e25a957f3f06707264199.zip
Bug 25400: Make CIRC_BW event properly total everything on a circ.
Diffstat (limited to 'src/or/relay.c')
-rw-r--r--src/or/relay.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/or/relay.c b/src/or/relay.c
index 72a902d8b4..d437204787 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -371,6 +371,15 @@ circuit_package_relay_cell(cell_t *cell, circuit_t *circ,
}
relay_encrypt_cell_outbound(cell, TO_ORIGIN_CIRCUIT(circ), layer_hint);
+
+ /* Update circ written totals for control port */
+ origin_circuit_t *ocirc = TO_ORIGIN_CIRCUIT(circ);
+ if (PREDICT_LIKELY(UINT32_MAX - ocirc->n_written_circ_bw
+ > CELL_PAYLOAD_SIZE))
+ ocirc->n_written_circ_bw += (int)CELL_PAYLOAD_SIZE;
+ else
+ ocirc->n_written_circ_bw = UINT32_MAX;
+
} else { /* incoming cell */
if (CIRCUIT_IS_ORIGIN(circ)) {
/* We should never package an _incoming_ cell from the circuit