[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] bugfix: tell circuits what id_digest to look for, so



Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	circuitbuild.c 
Log Message:
bugfix: tell circuits what id_digest to look for, so
n_conn_open() can find waiting circuits.


Index: circuitbuild.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuitbuild.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- circuitbuild.c	3 Jul 2004 01:37:59 -0000	1.8
+++ circuitbuild.c	12 Jul 2004 23:53:16 -0000	1.9
@@ -220,6 +220,8 @@
 
   log_fn(LOG_DEBUG,"Looking for firsthop '%s:%u'",
       firsthop->address,firsthop->or_port);
+  /* imprint the circuit with its future n_conn->id */
+  memcpy(circ->n_conn_id_digest, firsthop->identity_digest, DIGEST_LEN);
   n_conn = connection_get_by_identity_digest(firsthop->identity_digest,
                                              CONN_TYPE_OR);
   if(!n_conn || n_conn->state != OR_CONN_STATE_OPEN) { /* not currently connected */
@@ -245,7 +247,6 @@
     circ->n_addr = n_conn->addr;
     circ->n_port = n_conn->port;
     circ->n_conn = n_conn;
-    memcpy(circ->n_conn_id_digest, n_conn->identity_digest, DIGEST_LEN);
     log_fn(LOG_DEBUG,"Conn open. Delivering first onion skin.");
     if(circuit_send_next_onion_skin(circ) < 0) {
       log_fn(LOG_INFO,"circuit_send_next_onion_skin failed.");
@@ -262,6 +263,8 @@
 void circuit_n_conn_done(connection_t *or_conn, int success) {
   circuit_t *circ;
 
+  log_fn(LOG_DEBUG,"or_conn to %s, success=%d", or_conn->nickname, success);
+
   for(circ=global_circuitlist;circ;circ = circ->next) {
     if (circ->marked_for_close)
       continue;
@@ -492,6 +495,10 @@
 
     memcpy(circ->onionskin, onionskin, ONIONSKIN_CHALLENGE_LEN);
     circ->state = CIRCUIT_STATE_OR_WAIT;
+
+    /* imprint the circuit with its future n_conn->id */
+    memcpy(circ->n_conn_id_digest, id_digest, DIGEST_LEN);
+
     n_conn = connection_or_connect(circ->n_addr, circ->n_port, id_digest);
     if(!n_conn) {
       log_fn(LOG_INFO,"Launching n_conn failed. Closing.");