aboutsummaryrefslogtreecommitdiff
path: root/src/or/relay.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-12-29 19:55:17 +0000
committerNick Mathewson <nickm@torproject.org>2008-12-29 19:55:17 +0000
commitc1c7f982d964963023abc12eeef9bcaf9000d612 (patch)
tree1a2d2fac345124ef909798832b16baea6874045f /src/or/relay.c
parent145ead96edc1da55027f0fed8124ad3842dfdfbc (diff)
downloadtor-c1c7f982d964963023abc12eeef9bcaf9000d612.tar
tor-c1c7f982d964963023abc12eeef9bcaf9000d612.tar.gz
Do not not cannibalize a circuit that has run out of RELAY_EARLY cells. Partial bug 878 fix.
svn:r17815
Diffstat (limited to 'src/or/relay.c')
-rw-r--r--src/or/relay.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/or/relay.c b/src/or/relay.c
index 75bbf4cd2..7285c4690 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -510,10 +510,13 @@ relay_send_command_from_edge(uint16_t stream_id, circuit_t *circ,
if (cell_direction == CELL_DIRECTION_OUT) {
origin_circuit_t *origin_circ = TO_ORIGIN_CIRCUIT(circ);
- if (origin_circ->remaining_relay_early_cells > 0) {
- /* If we've got any relay_early cells left, use one. Don't worry
- * about the conn protocol version: append_cell_to_circuit_queue will
- * fix it up. */
+ if (origin_circ->remaining_relay_early_cells > 0 &&
+ (relay_command == RELAY_COMMAND_EXTEND ||
+ cpath_layer != origin_circ->cpath)) {
+ /* If we've got any relay_early cells left, and we're sending a relay
+ * cell or we're not talking to the first hop, use one of them. Don't
+ * worry about the conn protocol version: append_cell_to_circuit_queue
+ * will fix it up. */
cell.command = CELL_RELAY_EARLY;
--origin_circ->remaining_relay_early_cells;
log_debug(LD_OR, "Sending a RELAY_EARLY cell; %d remaining.",