]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
cleanup so connection_ap_handshake_attach_chosen_circuit() always
authorRoger Dingledine <arma@torproject.org>
Thu, 24 Mar 2005 06:18:59 +0000 (06:18 +0000)
committerRoger Dingledine <arma@torproject.org>
Thu, 24 Mar 2005 06:18:59 +0000 (06:18 +0000)
gets open circs.

svn:r3856

src/or/circuituse.c
src/or/control.c

index e9c20f59a8592a4bcc14f047ae38e918f54f9c01..22b9916818151d0698128ef9f4b4e01914765db3 100644 (file)
@@ -991,9 +991,7 @@ connection_ap_handshake_attach_chosen_circuit(connection_t *conn,
              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 28940e1d4d30499537bdc8b8b9233b5d381d8275..47c0cc0e68051923ecfcd8ea72214ee796fc8751 100644 (file)
@@ -745,6 +745,10 @@ static int handle_control_attachstream(connection_t *conn, uint32_t len,
     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;