[tor-commits] [tor/master] Set write low-watermarks on all bufferevents.
nickm at torproject.org
nickm at torproject.org
Wed Aug 24 21:57:27 UTC 2011
commit dfcd3d9ce00dedcf00124c9329985c5522f286dc
Author: Nick Mathewson <nickm at torproject.org>
Date: Wed Aug 24 17:30:20 2011 -0400
Set write low-watermarks on all bufferevents.
If we don't do this, then we never invoke the bufferevent write
callbacks until all the bufferevent's data is flushed.
---
changes/bug3805 | 5 +++++
src/or/connection.c | 5 +++++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/changes/bug3805 b/changes/bug3805
new file mode 100644
index 0000000..9d12b81
--- /dev/null
+++ b/changes/bug3805
@@ -0,0 +1,5 @@
+ o Major bugfixes (bufferevents):
+ - Correctly notice when data has been written from a bufferevent
+ without flushing it completely. Bugfix on 0.2.3.1-alpha; fixes
+ bug 3805.
+
diff --git a/src/or/connection.c b/src/or/connection.c
index c4cbef4..dc804dd 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -2947,6 +2947,11 @@ connection_configure_bufferevent_callbacks(connection_t *conn)
connection_handle_write_cb,
connection_handle_event_cb,
conn);
+ /* Set a fairly high write low-watermark so that we get the write callback
+ called whenever data is written to bring us under 128K. Leave the
+ high-watermark at 0.
+ */
+ bufferevent_setwatermark(bufev, EV_WRITE, 128*1024, 0);
input = bufferevent_get_input(bufev);
output = bufferevent_get_output(bufev);
More information about the tor-commits
mailing list