aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection_or.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-04-09 23:15:46 +0000
committerNick Mathewson <nickm@torproject.org>2007-04-09 23:15:46 +0000
commit58a6761056af4c5f50e9550f50625e91e55b30a1 (patch)
treeb469482f4858378361303c8844482820d7588d60 /src/or/connection_or.c
parent7529c8f548ad7304a3993d01a9f3312a8ed4f38e (diff)
downloadtor-58a6761056af4c5f50e9550f50625e91e55b30a1.tar.gz
tor-58a6761056af4c5f50e9550f50625e91e55b30a1.zip
r12330@catbus: nickm | 2007-04-09 19:15:42 -0400
Split type of "packed cell" from "parsed cell"; pack cells before queueing them on circuits. This will help us avoid dumb errors when we confuse the two types. svn:r9935
Diffstat (limited to 'src/or/connection_or.c')
-rw-r--r--src/or/connection_or.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index 7a3c6f2918..202f62b742 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -124,9 +124,10 @@ connection_or_set_identity_digest(or_connection_t *conn, const char *digest)
* in the buffer <b>dest</b>. See tor-spec.txt for details about the
* wire format.
*/
-static void
-cell_pack(char *dest, const cell_t *src)
+void
+cell_pack(packed_cell_t *dst, const cell_t *src)
{
+ char *dest = dst->body;
*(uint16_t*)dest = htons(src->circ_id);
*(uint8_t*)(dest+2) = src->command;
memcpy(dest+3, src->payload, CELL_PAYLOAD_SIZE);
@@ -738,15 +739,14 @@ connection_tls_finish_handshake(or_connection_t *conn)
void
connection_or_write_cell_to_buf(const cell_t *cell, or_connection_t *conn)
{
- char networkcell[CELL_NETWORK_SIZE];
- char *n = networkcell;
+ packed_cell_t networkcell;
tor_assert(cell);
tor_assert(conn);
- cell_pack(n, cell);
+ cell_pack(&networkcell, cell);
- connection_write_to_buf(n, CELL_NETWORK_SIZE, TO_CONN(conn));
+ connection_write_to_buf(networkcell.body, CELL_NETWORK_SIZE, TO_CONN(conn));
}
/** Process cells from <b>conn</b>'s inbuf.