Commit fb8cbc86 authored by Nick Mathewson's avatar Nick Mathewson 🏃
Browse files

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
parent a7ef07b4
......@@ -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();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment