diff options
author | Mike Perry <mikeperry-git@torproject.org> | 2018-04-02 07:16:19 +0000 |
---|---|---|
committer | Mike Perry <mikeperry-git@torproject.org> | 2018-04-16 21:46:31 +0000 |
commit | f921fd771ae51a82d971be064edca86b11f6004b (patch) | |
tree | a2838fca74089ba725113afd64b02aad842b46b6 /src/or/relay.c | |
parent | 0e06a9c3e76620881db95718f60441ce7de0f3c9 (diff) | |
download | tor-f921fd771ae51a82d971be064edca86b11f6004b.tar.gz tor-f921fd771ae51a82d971be064edca86b11f6004b.zip |
Use u32 add helper for CIRC_BW accounting.
There are quite a few other places this could be used, but keeping it simple
for now.
Diffstat (limited to 'src/or/relay.c')
-rw-r--r-- | src/or/relay.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/or/relay.c b/src/or/relay.c index d437204787..472e73b759 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -374,11 +374,8 @@ circuit_package_relay_cell(cell_t *cell, circuit_t *circ, /* 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; + ocirc->n_written_circ_bw = tor_add_u32_nowrap(ocirc->n_written_circ_bw, + CELL_PAYLOAD_SIZE); } else { /* incoming cell */ if (CIRCUIT_IS_ORIGIN(circ)) { |