diff options
author | Roger Dingledine <arma@torproject.org> | 2003-10-04 08:19:23 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2003-10-04 08:19:23 +0000 |
commit | 756619bfd2a0b0ea0606a820d2087e602ed94fbe (patch) | |
tree | c017ac604103f9afadd231250c635f9edc17c92f /src/or/command.c | |
parent | be874358a4385d8d6bd7f82d3f372bb79055033c (diff) | |
download | tor-756619bfd2a0b0ea0606a820d2087e602ed94fbe.tar.gz tor-756619bfd2a0b0ea0606a820d2087e602ed94fbe.zip |
refactor around connection_edge_send_command()
svn:r539
Diffstat (limited to 'src/or/command.c')
-rw-r--r-- | src/or/command.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/or/command.c b/src/or/command.c index 8caabf41dd..129dcfecb8 100644 --- a/src/or/command.c +++ b/src/or/command.c @@ -122,7 +122,6 @@ static void command_process_create_cell(cell_t *cell, connection_t *conn) { static void command_process_created_cell(cell_t *cell, connection_t *conn) { circuit_t *circ; - cell_t newcell; circ = circuit_get_by_aci_conn(cell->aci, conn); @@ -152,21 +151,9 @@ static void command_process_created_cell(cell_t *cell, connection_t *conn) { return; } } else { /* pack it into an extended relay cell, and send it. */ - memset(&newcell, 0, sizeof(cell_t)); - newcell.command = CELL_RELAY; - newcell.aci = circ->p_aci; - SET_CELL_RELAY_COMMAND(newcell, RELAY_COMMAND_EXTENDED); - SET_CELL_STREAM_ID(newcell, ZERO_STREAM); - - newcell.length = RELAY_HEADER_SIZE + cell->length; - memcpy(newcell.payload+RELAY_HEADER_SIZE, cell->payload, DH_KEY_LEN); - log_fn(LOG_INFO,"Converting created cell to extended relay cell, sending."); - if(circuit_deliver_relay_cell(&newcell, circ, CELL_DIRECTION_IN, NULL) < 0) { - log_fn(LOG_WARNING,"failed to deliver extended cell. Closing."); - circuit_close(circ); - return; - } + connection_edge_send_command(NULL, circ, RELAY_COMMAND_EXTENDED, + cell->payload, DH_KEY_LEN, NULL); } } @@ -225,7 +212,8 @@ static void command_process_destroy_cell(cell_t *cell, connection_t *conn) { } else { /* the destroy came from ahead */ circ->n_conn = NULL; log_fn(LOG_DEBUG, "Delivering 'truncated' back."); - connection_edge_send_command(NULL, circ, RELAY_COMMAND_TRUNCATED); + connection_edge_send_command(NULL, circ, RELAY_COMMAND_TRUNCATED, + NULL, 0, NULL); } } |