summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changes/ticket405484
-rw-r--r--src/core/or/scheduler_kist.c12
2 files changed, 14 insertions, 2 deletions
diff --git a/changes/ticket40548 b/changes/ticket40548
new file mode 100644
index 0000000000..277bb577a4
--- /dev/null
+++ b/changes/ticket40548
@@ -0,0 +1,4 @@
+ o Minor bugfixes (cell scheduling):
+ - Don't attempt to write 0 bytes after a cell scheduling loop. No empty
+ payload was put on the wire. Fixes bug 40548; bugfix on 0.3.5.1-alpha.
+ - Avoid writing empty payload with NSS write.
diff --git a/src/core/or/scheduler_kist.c b/src/core/or/scheduler_kist.c
index eba55f6497..52bc62f1b4 100644
--- a/src/core/or/scheduler_kist.c
+++ b/src/core/or/scheduler_kist.c
@@ -465,9 +465,17 @@ MOCK_IMPL(int, channel_should_write_to_kernel,
MOCK_IMPL(void, channel_write_to_kernel, (channel_t *chan))
{
tor_assert(chan);
+
+ /* This is possible because a channel might have an outbuf table entry even
+ * though it has no more cells in its outbuf. Just move on. */
+ size_t outbuf_len = channel_outbuf_length(chan);
+ if (outbuf_len == 0) {
+ return;
+ }
+
log_debug(LD_SCHED, "Writing %lu bytes to kernel for chan %" PRIu64,
- (unsigned long)channel_outbuf_length(chan),
- chan->global_identifier);
+ (unsigned long) outbuf_len, chan->global_identifier);
+
/* Note that 'connection_handle_write()' may change the scheduler state of
* the channel during the scheduling loop with
* 'connection_or_flushed_some()' -> 'scheduler_channel_wants_writes()'.