diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-03-04 11:03:30 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-03-04 11:03:30 -0500 |
commit | ab225aaf28d7a25a58b5f11f1c59ded80570b594 (patch) | |
tree | 2cef1ba108879d507296d6a089f9cebc5237fad8 /src/or/relay.c | |
parent | bfa0e022bc6ec629473d3dfb598cad698ceee256 (diff) | |
parent | bb375442141b4a5b301212394ce3e106cb34daf2 (diff) | |
download | tor-ab225aaf28d7a25a58b5f11f1c59ded80570b594.tar.gz tor-ab225aaf28d7a25a58b5f11f1c59ded80570b594.zip |
Merge branch 'bug10169_025_v2'
Conflicts:
src/test/test.c
Diffstat (limited to 'src/or/relay.c')
-rw-r--r-- | src/or/relay.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/or/relay.c b/src/or/relay.c index dc234c1f2a..d6742d25e1 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -2153,7 +2153,8 @@ cell_queue_append_packed_copy(circuit_t *circ, cell_queue_t *queue, (void)circ; (void)exitward; (void)use_stats; - tor_gettimeofday_cached(&now); + tor_gettimeofday_cached_monotonic(&now); + copy->inserted_time = (uint32_t)tv_to_msec(&now); cell_queue_append(queue, copy); @@ -2201,13 +2202,21 @@ packed_cell_mem_cost(void) return sizeof(packed_cell_t) + MP_POOL_ITEM_OVERHEAD; } +/** DOCDOC */ +STATIC size_t +cell_queues_get_total_allocation(void) +{ + return total_cells_allocated * packed_cell_mem_cost(); +} + /** Check whether we've got too much space used for cells. If so, * call the OOM handler and return 1. Otherwise, return 0. */ -static int +STATIC int cell_queues_check_size(void) { - size_t alloc = total_cells_allocated * packed_cell_mem_cost(); - if (alloc >= get_options()->MaxMemInCellQueues) { + size_t alloc = cell_queues_get_total_allocation(); + alloc += buf_get_total_allocation(); + if (alloc >= get_options()->MaxMemInQueues) { circuits_handle_oom(alloc); return 1; } |