summaryrefslogtreecommitdiff
path: root/src/or/command.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-03-26 14:07:59 +0000
committerNick Mathewson <nickm@torproject.org>2007-03-26 14:07:59 +0000
commit38c0bb3a99956a0ff2e570bd8f2b900d46741992 (patch)
tree9a447e7b431abdc819d3ba1f30755f5b40678c79 /src/or/command.c
parent6e51bdd5e4d5ab39fc1dca12e468b9a1c573cc1b (diff)
downloadtor-38c0bb3a99956a0ff2e570bd8f2b900d46741992.tar.gz
tor-38c0bb3a99956a0ff2e570bd8f2b900d46741992.zip
r12651@Kushana: nickm | 2007-03-24 18:26:42 -0400
Initial version of circuit-based cell queues. Instead of hammering or_conns with piles of cells, queue cells on their corresponding circuits, and append them to the or_conn as needed. This seems to work so far, but needs a bit more work. This will break the memory-use-limitation patch for begin_dir conns: the solution will be a fun but fiddly. svn:r9904
Diffstat (limited to 'src/or/command.c')
-rw-r--r--src/or/command.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/src/or/command.c b/src/or/command.c
index e278725e8f..381ca3756a 100644
--- a/src/or/command.c
+++ b/src/or/command.c
@@ -305,7 +305,7 @@ static void
command_process_relay_cell(cell_t *cell, or_connection_t *conn)
{
circuit_t *circ;
- int reason;
+ int reason, direction;
circ = circuit_get_by_circid_orconn(cell->circ_id, conn);
@@ -323,23 +323,16 @@ command_process_relay_cell(cell_t *cell, or_connection_t *conn)
}
if (!CIRCUIT_IS_ORIGIN(circ) &&
- cell->circ_id == TO_OR_CIRCUIT(circ)->p_circ_id) {
- /* it's an outgoing cell */
- if ((reason = circuit_receive_relay_cell(cell, circ,
- CELL_DIRECTION_OUT)) < 0) {
- log_fn(LOG_PROTOCOL_WARN,LD_PROTOCOL,"circuit_receive_relay_cell "
- "(forward) failed. Closing.");
- circuit_mark_for_close(circ, -reason);
- return;
- }
- } else { /* it's an ingoing cell */
- if ((reason = circuit_receive_relay_cell(cell, circ,
- CELL_DIRECTION_IN)) < 0) {
- log_fn(LOG_PROTOCOL_WARN,LD_PROTOCOL,"circuit_receive_relay_cell "
- "(backward) failed. Closing.");
- circuit_mark_for_close(circ, -reason);
- return;
- }
+ cell->circ_id == TO_OR_CIRCUIT(circ)->p_circ_id)
+ direction = CELL_DIRECTION_OUT;
+ else
+ direction = CELL_DIRECTION_IN;
+
+ if ((reason = circuit_receive_relay_cell(cell, circ, direction)) < 0) {
+ log_fn(LOG_PROTOCOL_WARN,LD_PROTOCOL,"circuit_receive_relay_cell "
+ "(%s) failed. Closing.",
+ direction==CELL_DIRECTION_OUT?"forward":"backward");
+ circuit_mark_for_close(circ, -reason);
}
}