[or-cvs] r12984: Fix in flush_buf_tls: it is okay to flush an empty buffer, s (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Wed Dec 26 00:36:05 UTC 2007


Author: nickm
Date: 2007-12-25 19:36:05 -0500 (Tue, 25 Dec 2007)
New Revision: 12984

Modified:
   tor/trunk/
   tor/trunk/src/or/buffers.c
Log:
 r15710 at 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.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r15710] on d9e39d38-0f13-419c-a857-e10a0ce2aa0c

Modified: tor/trunk/src/or/buffers.c
===================================================================
--- tor/trunk/src/or/buffers.c	2007-12-26 00:12:08 UTC (rev 12983)
+++ tor/trunk/src/or/buffers.c	2007-12-26 00:36:05 UTC (rev 12984)
@@ -113,6 +113,7 @@
 
 /** 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 @@
   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();



More information about the tor-commits mailing list