summaryrefslogtreecommitdiff
path: root/src/or/channel.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-10-02 21:42:24 -0400
committerNick Mathewson <nickm@torproject.org>2013-10-02 22:20:18 -0400
commit557f3329575cd6d1a2dd36fa8fb9cf0ac0b3f721 (patch)
tree1d45f04713d62a5ee1c9aae2fb4c8ae1bda0f728 /src/or/channel.c
parent938ee9b24dfda03a68a71d43b88e9fb00a90f9c8 (diff)
downloadtor-557f3329575cd6d1a2dd36fa8fb9cf0ac0b3f721.tar.gz
tor-557f3329575cd6d1a2dd36fa8fb9cf0ac0b3f721.zip
Fix a bug in our bug 9776 fix.
By calling circuit_n_chan_done() unconditionally on close, we were closing pending connections that might not have been pending quite for the connection we were closing. Fix for bug 9880. Thanks to skruffy for finding this and explaining it patiently until we understood.
Diffstat (limited to 'src/or/channel.c')
-rw-r--r--src/or/channel.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/or/channel.c b/src/or/channel.c
index 1fb39b88ca..1270eace7d 100644
--- a/src/or/channel.c
+++ b/src/or/channel.c
@@ -743,6 +743,9 @@ channel_init(channel_t *chan)
/* Timestamp it */
channel_timestamp_created(chan);
+
+ /* It hasn't been open yet. */
+ chan->has_been_open = 0;
}
/**
@@ -1294,7 +1297,8 @@ channel_closed(channel_t *chan)
/* Inform any pending (not attached) circs that they should
* give up. */
- circuit_n_chan_done(chan, 0);
+ if (! chan->has_been_open)
+ circuit_n_chan_done(chan, 0);
/* Now close all the attached circuits on it. */
circuit_unlink_all_from_channel(chan, END_CIRC_REASON_CHANNEL_CLOSED);
@@ -1935,6 +1939,7 @@ channel_change_state(channel_t *chan, channel_state_t to_state)
/* Tell circuits if we opened and stuff */
if (to_state == CHANNEL_STATE_OPEN) {
channel_do_open_actions(chan);
+ chan->has_been_open = 1;
/* Check for queued cells to process */
if (! TOR_SIMPLEQ_EMPTY(&chan->incoming_queue))