diff options
author | Andrea Shepard <andrea@torproject.org> | 2012-11-06 17:58:59 -0800 |
---|---|---|
committer | Andrea Shepard <andrea@torproject.org> | 2012-11-06 17:58:59 -0800 |
commit | 80eb03ae0a1599f5429789b5a6f2659b8f4cbe4a (patch) | |
tree | ca3b93cf9c10fa9a2927c36df97c47777dcaa315 /src/or/circuitlist.c | |
parent | 688cea7248584b0202fc269a9f009bfa97e598bc (diff) | |
download | tor-80eb03ae0a1599f5429789b5a6f2659b8f4cbe4a.tar.gz tor-80eb03ae0a1599f5429789b5a6f2659b8f4cbe4a.zip |
Don't call channel_send_destroy() when closing a circuit on a closing channel
Diffstat (limited to 'src/or/circuitlist.c')
-rw-r--r-- | src/or/circuitlist.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c index 3ec2bf15bb..32a478d744 100644 --- a/src/or/circuitlist.c +++ b/src/or/circuitlist.c @@ -1411,7 +1411,12 @@ circuit_mark_for_close_(circuit_t *circ, int reason, int line, } if (circ->n_chan) { circuit_clear_cell_queue(circ, circ->n_chan); - channel_send_destroy(circ->n_circ_id, circ->n_chan, reason); + /* Only send destroy if the channel isn't closing anyway */ + if (!(circ->n_chan->state == CHANNEL_STATE_CLOSING || + circ->n_chan->state == CHANNEL_STATE_CLOSED || + circ->n_chan->state == CHANNEL_STATE_ERROR)) { + channel_send_destroy(circ->n_circ_id, circ->n_chan, reason); + } circuitmux_detach_circuit(circ->n_chan->cmux, circ); } @@ -1439,7 +1444,12 @@ circuit_mark_for_close_(circuit_t *circ, int reason, int line, if (or_circ->p_chan) { circuit_clear_cell_queue(circ, or_circ->p_chan); - channel_send_destroy(or_circ->p_circ_id, or_circ->p_chan, reason); + /* Only send destroy if the channel isn't closing anyway */ + if (!(or_circ->p_chan->state == CHANNEL_STATE_CLOSING || + or_circ->p_chan->state == CHANNEL_STATE_CLOSED || + or_circ->p_chan->state == CHANNEL_STATE_ERROR)) { + channel_send_destroy(or_circ->p_circ_id, or_circ->p_chan, reason); + } circuitmux_detach_circuit(or_circ->p_chan->cmux, circ); } } else { |