[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[or-cvs] bugfix: couldn"t send two creates, two datas, and the destr...



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

Modified Files:
	circuit.c command.c 
Log Message:
bugfix: couldn't send two creates, two datas, and the destroy all at once

(amazing the odd behavior you get to test when you have a flaky modem
connection)


Index: circuit.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuit.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- circuit.c	3 Dec 2002 22:18:23 -0000	1.18
+++ circuit.c	23 Dec 2002 06:48:14 -0000	1.19
@@ -352,6 +352,7 @@
     circuit_remove(circ);
     if(circ->n_conn == conn) /* it's closing in front of us */
       /* circ->p_conn should always be set */
+      assert(circ->p_conn);
       connection_send_destroy(circ->p_aci, circ->p_conn);
     if(circ->p_conn == conn) /* it's closing behind us */
       if(circ->n_conn)

Index: command.c
===================================================================
RCS file: /home/or/cvsroot/src/or/command.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- command.c	27 Nov 2002 04:08:19 -0000	1.15
+++ command.c	23 Dec 2002 06:48:14 -0000	1.16
@@ -300,10 +300,14 @@
     onion_pending_remove(circ);
   }
   circuit_remove(circ);
-  if(cell->aci == circ->p_aci) /* the destroy came from behind */
-    connection_send_destroy(circ->n_aci, circ->n_conn);
-  if(cell->aci == circ->n_aci) /* the destroy came from ahead */
+  if(cell->aci == circ->p_aci) { /* the destroy came from behind */
+    if(circ->n_conn) /* might not be defined, eg if it was just on the pending queue */
+      connection_send_destroy(circ->n_aci, circ->n_conn);
+  }
+  if(cell->aci == circ->n_aci) { /* the destroy came from ahead */
+    assert(circ->p_conn);
     connection_send_destroy(circ->p_aci, circ->p_conn);
+  }
   circuit_free(circ);
 }