[or-cvs] Use cell.topic* fields in ap_handshake_send_begin

Nick Mathewson nickm at seul.org
Thu Apr 17 16:46:46 UTC 2003


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv24666/src/or

Modified Files:
	connection_ap.c 
Log Message:
Use cell.topic* fields in ap_handshake_send_begin

Index: connection_ap.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_ap.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- connection_ap.c	16 Apr 2003 06:18:30 -0000	1.35
+++ connection_ap.c	17 Apr 2003 16:46:44 -0000	1.36
@@ -124,10 +124,11 @@
   /* deliver the dest_addr in a data cell */
   cell.command = CELL_DATA;
   cell.aci = circ->n_aci;
-  crypto_pseudo_rand(2, cell.payload+2); /* bytes 0-1 is blank, bytes 2-3 are random */
+  cell.topic_command = TOPIC_COMMAND_BEGIN;
+  crypto_pseudo_rand(2, (char*)&cell.topic_id);
   /* FIXME check for collisions */
-  ap_conn->topic_id = ntohs(*(uint16_t *)(cell.payload+2));
-  cell.payload[0] = TOPIC_COMMAND_BEGIN;
+  ap_conn->topic_id = cell.topic_id;
+
   snprintf(cell.payload+4, CELL_PAYLOAD_SIZE-4, "%s:%d", ap_conn->dest_addr, ap_conn->dest_port);
   cell.length = strlen(cell.payload+TOPIC_HEADER_SIZE)+1+TOPIC_HEADER_SIZE;
   log(LOG_DEBUG,"ap_handshake_send_begin(): Sending data cell to begin topic %d.", ap_conn->topic_id);



More information about the tor-commits mailing list