[or-cvs] cleanup so connection_ap_handshake_attach_chosen_circuit() ...

Roger Dingledine arma at seul.org
Thu Mar 24 06:19:02 UTC 2005


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

Modified Files:
	circuituse.c control.c 
Log Message:
cleanup so connection_ap_handshake_attach_chosen_circuit() always
gets open circs.


Index: circuituse.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/circuituse.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- circuituse.c	24 Mar 2005 06:05:14 -0000	1.60
+++ circuituse.c	24 Mar 2005 06:18:59 -0000	1.61
@@ -991,9 +991,7 @@
              conn->state == AP_CONN_STATE_CONTROLLER_WAIT);
   tor_assert(conn->socks_request);
   tor_assert(circ);
-
-  if (circ->state != CIRCUIT_STATE_OPEN)
-    return 0;
+  tor_assert(circ->state == CIRCUIT_STATE_OPEN);
 
   conn->state = AP_CONN_STATE_CIRCUIT_WAIT;
 

Index: control.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/control.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- control.c	24 Mar 2005 01:08:25 -0000	1.66
+++ control.c	24 Mar 2005 06:18:59 -0000	1.67
@@ -745,6 +745,10 @@
     send_control_error(conn, ERR_NO_CIRC, "No circuit found with given ID");
     return 0;
   }
+  if (circ->state != CIRCUIT_STATE_OPEN) {
+    send_control_error(conn, ERR_INTERNAL, "Refuse to attach stream to non-open circ.");
+    return 0;
+  }
   if (connection_ap_handshake_attach_chosen_circuit(ap_conn, circ) != 1) {
     send_control_error(conn, ERR_INTERNAL, "Unable to attach stream.");
     return 0;



More information about the tor-commits mailing list