[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r9107: when we're doing a write split over the end of a circular bu (tor/trunk/src/or)



Author: arma
Date: 2006-12-13 22:26:42 -0500 (Wed, 13 Dec 2006)
New Revision: 9107

Modified:
   tor/trunk/src/or/buffers.c
Log:
when we're doing a write split over the end of a circular
buffer, make sure our tls_get_forced_write_size doesn't
make it write whatever's after the buffer.

this hasn't triggered yet, but it would be rare, so let's
leave it in.


Modified: tor/trunk/src/or/buffers.c
===================================================================
--- tor/trunk/src/or/buffers.c	2006-12-13 23:00:05 UTC (rev 9106)
+++ tor/trunk/src/or/buffers.c	2006-12-14 03:26:42 UTC (rev 9107)
@@ -694,6 +694,10 @@
 
   flushlen0 = sz;
   _split_range(buf, buf->cur, &flushlen0, &flushlen1);
+  if (flushlen1) {
+    size_t forced = tor_tls_get_forced_write_size(tls);
+    tor_assert(forced <= flushlen0);
+  }
 
   r = flush_buf_tls_impl(tls, buf, flushlen0, buf_flushlen);
   check();