aboutsummaryrefslogtreecommitdiff
path: root/src/or/buffers.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-08-16 00:27:05 -0400
committerNick Mathewson <nickm@torproject.org>2010-08-16 00:27:05 -0400
commitbf8d66364fed39113d0ca953c55c10b9f5f34703 (patch)
tree50d2fd480236577439fe4a4a4202fb9a6719d497 /src/or/buffers.c
parent15379a7254a5d17ab9a2057435a6daa9c08ae880 (diff)
parent8150e2ad245e9d2dbfb35ae53384424efd749890 (diff)
downloadtor-bf8d66364fed39113d0ca953c55c10b9f5f34703.tar
tor-bf8d66364fed39113d0ca953c55c10b9f5f34703.tar.gz
Merge commit 'public/warn1125'
Diffstat (limited to 'src/or/buffers.c')
-rw-r--r--src/or/buffers.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c
index 3ba2760bf..e8422637c 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -270,14 +270,25 @@ buf_shrink_freelists(int free_all)
(freelists[i].lowest_length - slack);
int n_to_skip = freelists[i].cur_length - n_to_free;
int orig_n_to_free = n_to_free, n_freed=0;
+ int orig_n_to_skip = n_to_skip;
int new_length = n_to_skip;
chunk_t **chp = &freelists[i].head;
chunk_t *chunk;
- log_info(LD_MM, "Cleaning freelist for %d-byte chunks: keeping %d, "
- "dropping %d.",
- (int)freelists[i].alloc_size, n_to_skip, n_to_free);
+ log_info(LD_MM, "Cleaning freelist for %d-byte chunks: length %d, "
+ "keeping %d, dropping %d.",
+ (int)freelists[i].alloc_size, freelists[i].cur_length,
+ n_to_skip, n_to_free);
+ tor_assert(n_to_skip + n_to_free == freelists[i].cur_length);
while (n_to_skip) {
- tor_assert((*chp)->next);
+ if (! (*chp)->next) {
+ log_warn(LD_BUG, "I wanted to skip %d chunks in the freelist for "
+ "%d-byte chunks, but only found %d. (Length %d)",
+ orig_n_to_skip, (int)freelists[i].alloc_size,
+ orig_n_to_skip-n_to_skip, freelists[i].cur_length);
+ assert_freelist_ok(&freelists[i]);
+ return;
+ }
+ // tor_assert((*chp)->next);
chp = &(*chp)->next;
--n_to_skip;
}