summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-03-19 16:43:00 -0400
committerNick Mathewson <nickm@torproject.org>2013-03-19 16:43:00 -0400
commitf1caa2f2146ac750962e6506fe672b03749c50f9 (patch)
tree9e3722d4e651029bfe6735c75fee1d2a6ae385a9
parent323cb655be7802a3f527bfa4278478d9fbd23944 (diff)
parentca50fb4f81a1f48c82d75825687085cda4627424 (diff)
downloadtor-f1caa2f2146ac750962e6506fe672b03749c50f9.tar.gz
tor-f1caa2f2146ac750962e6506fe672b03749c50f9.zip
Merge branch 'bug7350_redux' into maint-0.2.4
-rw-r--r--changes/bug73504
-rw-r--r--src/or/channel.c24
2 files changed, 28 insertions, 0 deletions
diff --git a/changes/bug7350 b/changes/bug7350
new file mode 100644
index 0000000000..b0ee9d0919
--- /dev/null
+++ b/changes/bug7350
@@ -0,0 +1,4 @@
+ o Major bugfixes:
+ - Avoid an assertion when we discover that we'd like to write a cell
+ onto a closing connection: just discard the cell. Fixes another
+ case of bug 7350; bugfix on 0.2.4.4-alpha.
diff --git a/src/or/channel.c b/src/or/channel.c
index 82db061af9..4e9086f2e6 100644
--- a/src/or/channel.c
+++ b/src/or/channel.c
@@ -1751,6 +1751,14 @@ channel_write_cell(channel_t *chan, cell_t *cell)
tor_assert(chan);
tor_assert(cell);
+ if (chan->state == CHANNEL_STATE_CLOSING) {
+ log_debug(LD_CHANNEL, "Discarding cell_t %p on closing channel %p with "
+ "global ID "U64_FORMAT, cell, chan,
+ U64_PRINTF_ARG(chan->global_identifier));
+ tor_free(cell);
+ return;
+ }
+
log_debug(LD_CHANNEL,
"Writing cell_t %p to channel %p with global ID "
U64_FORMAT,
@@ -1777,6 +1785,14 @@ channel_write_packed_cell(channel_t *chan, packed_cell_t *packed_cell)
tor_assert(chan);
tor_assert(packed_cell);
+ if (chan->state == CHANNEL_STATE_CLOSING) {
+ log_debug(LD_CHANNEL, "Discarding packed_cell_t %p on closing channel %p "
+ "with global ID "U64_FORMAT, packed_cell, chan,
+ U64_PRINTF_ARG(chan->global_identifier));
+ packed_cell_free(packed_cell);
+ return;
+ }
+
log_debug(LD_CHANNEL,
"Writing packed_cell_t %p to channel %p with global ID "
U64_FORMAT,
@@ -1805,6 +1821,14 @@ channel_write_var_cell(channel_t *chan, var_cell_t *var_cell)
tor_assert(chan);
tor_assert(var_cell);
+ if (chan->state == CHANNEL_STATE_CLOSING) {
+ log_debug(LD_CHANNEL, "Discarding var_cell_t %p on closing channel %p "
+ "with global ID "U64_FORMAT, var_cell, chan,
+ U64_PRINTF_ARG(chan->global_identifier));
+ var_cell_free(var_cell);
+ return;
+ }
+
log_debug(LD_CHANNEL,
"Writing var_cell_t %p to channel %p with global ID "
U64_FORMAT,