diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-09-29 09:26:16 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-09-29 09:33:47 -0400 |
commit | d256d4c0a6c6a258c4f6c6839dd53c7e304fa94f (patch) | |
tree | 6c0bb9086e7aad4a835975bdd313ca7e491a75e2 | |
parent | 09618ffe38bc6cd91755c6c1aedb86dc099dfdf8 (diff) | |
download | tor-d256d4c0a6c6a258c4f6c6839dd53c7e304fa94f.tar.gz tor-d256d4c0a6c6a258c4f6c6839dd53c7e304fa94f.zip |
Don't package cells onto marked circuits.
This caused a BUG log when we noticed that the circuit had no
channel. The likeliest culprit for exposing that behavior is
d769cab3e5097980, where we made circuit_mark_for_close() NULL out
the n_chan and p_chan fields of the circuit.
Fixes bug 8185; bugfix on 0.2.5.4-alpha, I think.
-rw-r--r-- | changes/bug8185_025 | 6 | ||||
-rw-r--r-- | src/or/relay.c | 11 |
2 files changed, 17 insertions, 0 deletions
diff --git a/changes/bug8185_025 b/changes/bug8185_025 new file mode 100644 index 0000000000..1bfc12b1e4 --- /dev/null +++ b/changes/bug8185_025 @@ -0,0 +1,6 @@ + o Minor bugfixes (logging, relay shutdown, annoyance): + - When a circuit is marked for close, do not attempt to package any cells + for channels on that circuit. Previously, we would detect this + condition lower in the call stack, when we noticed that the circuit had + no attached channel, and log an annoying message. Fixes bug 8185; + bugfix on 0.2.5.4-alpha. diff --git a/src/or/relay.c b/src/or/relay.c index daf354c34c..48c823423a 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -390,6 +390,11 @@ circuit_package_relay_cell(cell_t *cell, circuit_t *circ, { channel_t *chan; /* where to send the cell */ + if (circ->marked_for_close) { + /* Circuit is marked; send nothing. */ + return 0; + } + if (cell_direction == CELL_DIRECTION_OUT) { crypt_path_t *thishop; /* counter for repeated crypts */ chan = circ->n_chan; @@ -703,6 +708,12 @@ connection_edge_send_command(edge_connection_t *fromconn, return -1; } + if (circ->marked_for_close) { + /* The circuit has been marked, but not freed yet. When it's freed, it + * will mark this connection for close. */ + return -1; + } + return relay_send_command_from_edge(fromconn->stream_id, circ, relay_command, payload, payload_len, cpath_layer); |