diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-12-26 00:36:05 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-12-26 00:36:05 +0000 |
commit | fb8cbc8642f9833d686f803d588963e80337f5fd (patch) | |
tree | 309182cda887b4c3a42bf55f0cd59509119fe9d5 | |
parent | a7ef07b4bd3a4a3ba66336601e5a27649cb923d9 (diff) | |
download | tor-fb8cbc8642f9833d686f803d588963e80337f5fd.tar.gz tor-fb8cbc8642f9833d686f803d588963e80337f5fd.zip |
r15710@tombo: nickm | 2007-12-25 19:36:03 -0500
Fix in flush_buf_tls: it is okay to flush an empty buffer, since we may have a partial TLS record pending.
svn:r12984
-rw-r--r-- | src/or/buffers.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c index fe4d26db02..3d21034ce2 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -113,6 +113,7 @@ typedef struct chunk_freelist_t { /** Static array of freelists, sorted by alloc_len, terminated by an entry * with alloc_size of 0. */ +/**XXXX020 tune these values. */ static chunk_freelist_t freelists[] = { FL(256, 1024, 16), FL(512, 1024, 16), FL(1024, 512, 8), FL(4096, 256, 8), FL(8192, 128, 4), FL(16384, 64, 4), FL(0, 0, 0) @@ -735,11 +736,14 @@ flush_buf_tls(tor_tls_t *tls, buf_t *buf, size_t sz, size_t *buf_flushlen) check(); while (sz) { size_t flushlen0; - tor_assert(buf->head); - if (buf->head->datalen >= sz) - flushlen0 = sz; - else - flushlen0 = buf->head->datalen; + if (buf->head) { + if (buf->head->datalen >= sz) + flushlen0 = sz; + else + flushlen0 = buf->head->datalen; + } else { + flushlen0 = 0; + } r = flush_chunk_tls(tls, buf, buf->head, flushlen0, buf_flushlen); check(); |