[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r9105: Try to fix an assert failure in new write limiting code: mak (in tor/trunk: . src/common src/or)
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] r9105: Try to fix an assert failure in new write limiting code: mak (in tor/trunk: . src/common src/or)
- From: nickm@xxxxxxxx
- Date: Wed, 13 Dec 2006 17:46:43 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Wed, 13 Dec 2006 17:46:57 -0500
- Reply-to: or-talk@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Author: nickm
Date: 2006-12-13 17:46:42 -0500 (Wed, 13 Dec 2006)
New Revision: 9105
Modified:
tor/trunk/
tor/trunk/src/common/tortls.c
tor/trunk/src/common/tortls.h
tor/trunk/src/or/buffers.c
Log:
r11566@Kushana: nickm | 2006-12-13 17:46:24 -0500
Try to fix an assert failure in new write limiting code: make buffers.c aware of previous "forced" write sizes from tortls.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r11566] on c95137ef-5f19-0410-b913-86e773d04f59
Modified: tor/trunk/src/common/tortls.c
===================================================================
--- tor/trunk/src/common/tortls.c 2006-12-13 22:42:52 UTC (rev 9104)
+++ tor/trunk/src/common/tortls.c 2006-12-13 22:46:42 UTC (rev 9105)
@@ -850,7 +850,14 @@
return 0;
#endif
return SSL_pending(tls->ssl);
+}
+/** If <b>tls</b> requires that the next write be of a particular size,
+ * return that size. Otherwise, return 0. */
+size_t
+tor_tls_get_forced_write_size(tor_tls_t *tls)
+{
+ return tls->wantwrite_n;
}
/** Return the number of bytes read across the underlying socket. */
Modified: tor/trunk/src/common/tortls.h
===================================================================
--- tor/trunk/src/common/tortls.h 2006-12-13 22:42:52 UTC (rev 9104)
+++ tor/trunk/src/common/tortls.h 2006-12-13 22:46:42 UTC (rev 9105)
@@ -41,6 +41,7 @@
int tor_tls_handshake(tor_tls_t *tls);
int tor_tls_shutdown(tor_tls_t *tls);
int tor_tls_get_pending_bytes(tor_tls_t *tls);
+size_t tor_tls_get_forced_write_size(tor_tls_t *tls);
unsigned long tor_tls_get_n_bytes_read(tor_tls_t *tls);
unsigned long tor_tls_get_n_bytes_written(tor_tls_t *tls);
Modified: tor/trunk/src/or/buffers.c
===================================================================
--- tor/trunk/src/or/buffers.c 2006-12-13 22:42:52 UTC (rev 9104)
+++ tor/trunk/src/or/buffers.c 2006-12-13 22:46:42 UTC (rev 9105)
@@ -648,16 +648,21 @@
return flushed;
}
-/** Helper for flush_buf_tls(): try to write <b>sz</b> bytes from buffer
- * <b>buf</b> onto TLS object <b>tls</b>. On success, deduct the bytes
- * written from *<b>buf_flushlen</b>.
- * Return the number of bytes written on success, -1 on failure.
+/** Helper for flush_buf_tls(): try to write <b>sz</b> bytes (or more if
+ * required by a previous write) from buffer <b>buf</b> onto TLS object
+ * <b>tls</b>. On success, deduct the bytes written from
+ * *<b>buf_flushlen</b>. Return the number of bytes written on success, -1 on
+ * failure.
*/
static INLINE int
flush_buf_tls_impl(tor_tls_t *tls, buf_t *buf, size_t sz, size_t *buf_flushlen)
{
int r;
+ size_t forced;
+ forced = tor_tls_get_forced_write_size(tls);
+ if (forced < sz)
+ sz = forced;
r = tor_tls_write(tls, buf->cur, sz);
if (r < 0) {
return r;