diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-07-23 15:58:38 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-07-23 15:58:38 +0000 |
commit | ea95ce25b63e6a291d9c816308919caf887fa7ea (patch) | |
tree | 46fcdd336a7197acf4b3fb6b861d9c9068be3ef3 /src/or/relay.c | |
parent | 2748afe60961596791bceb842dce2385c5b4db7e (diff) | |
download | tor-ea95ce25b63e6a291d9c816308919caf887fa7ea.tar.gz tor-ea95ce25b63e6a291d9c816308919caf887fa7ea.zip |
r17323@aud-055: nickm | 2008-07-23 17:58:25 +0200
Implement most of proposal 110.
svn:r16156
Diffstat (limited to 'src/or/relay.c')
-rw-r--r-- | src/or/relay.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/or/relay.c b/src/or/relay.c index 40a5ee0103..155f066692 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -338,6 +338,7 @@ circuit_package_relay_cell(cell_t *cell, circuit_t *circ, log_warn(LD_BUG,"outgoing relay cell has n_conn==NULL. Dropping."); return 0; /* just drop it */ } + relay_set_digest(layer_hint->f_digest, cell); thishop = layer_hint; @@ -506,6 +507,22 @@ relay_send_command_from_edge(uint16_t stream_id, circuit_t *circ, circ->n_conn->client_used = time(NULL); } + 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. */ + cell.command = CELL_RELAY_EARLY; + --origin_circ->remaining_relay_early_cells; + log_debug(LD_OR, "Sending a RELAY_EARLY cell; %d remaining.", + (int)origin_circ->remaining_relay_early_cells); + } else if (relay_command == RELAY_COMMAND_EXTEND) { + log_warn(LD_BUG, "Uh-oh. We're sending a RELAY_COMMAND_EXTEND cell, " + "but we have run out of RELAY_EARLY cells on that circuit."); + } + } + if (circuit_package_relay_cell(&cell, circ, cell_direction, cpath_layer) < 0) { log_warn(LD_BUG,"circuit_package_relay_cell failed. Closing."); |