aboutsummaryrefslogtreecommitdiff
path: root/src/or/channel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/channel.c')
-rw-r--r--src/or/channel.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/or/channel.c b/src/or/channel.c
index 602797d0d..1270eace7 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;
}
/**
@@ -1292,11 +1295,11 @@ channel_closed(channel_t *chan)
if (chan->state == CHANNEL_STATE_CLOSED ||
chan->state == CHANNEL_STATE_ERROR) return;
- if (chan->reason_for_closing == CHANNEL_CLOSE_FOR_ERROR) {
- /* Inform any pending (not attached) circs that they should
- * give up. */
+ /* Inform any pending (not attached) circs that they should
+ * give up. */
+ 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);
@@ -1936,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))